StopUpdatingLocation 方法不适用于 iOS5 [英] StopUpdatingLocation method not working for iOS5

查看:17
本文介绍了StopUpdatingLocation 方法不适用于 iOS5的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发地图应用程序,

I am working on map application,

我正在尝试使用 [locationManager stopUpdatingLocation]; 方法来停止定位服务.

I am try to use [locationManager stopUpdatingLocation]; method to stop the Location services.

在iOS4.3好像可以正常使用,但是在iOS5就不行了.

It seems that it works fine in iOS4.3 but in iOS5, it's not working.

请任何人建议我如何在 iOS5 中停止定位服务?

Please any one suggest me How to stop location services in iOS5?

推荐答案

有时位置管理器即使在 stopUpdationLocations 之后也不会停止.

Sometimes it happens that location manager does not stop even after stopUpdationLocations.

您需要为该集合释放您的位置管理器:

You need to release your location manager, for that set:

locationManager = nil;

这应该写在:

[locationManager stopUpdatingLocation];

另外,请注意不要在将 locationManager 对象设置为 nil 后调用它,否则您的应用程序将崩溃.

Also, take care you don't call locationManager object, after setting it to nil, else your application will crash.

如果它仍然没有停止位置服务,那么有解决方案,如果您以后不想使用它,只需使用 BOOL 变量.

If it stills not stopping location services, then there is work around solution, just use BOOL variable if you don't want to use it in future.

这篇关于StopUpdatingLocation 方法不适用于 iOS5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆