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

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

问题描述

我正在处理地图应用程式,



我尝试使用 [locationManager stopUpdatingLocation]; 方法停止定位服务。 / p>

它似乎在iOS4.3中可以正常工作,但在iOS5中,它不工作。



建议我如何在iOS5中停止位置服务?

解决方案

有时会发生位置管理器即使在 stopUpdationLocations



您需要发布您的位置管理器

  locationManager = nil; 

这应该写在

之后

code> [locationManager stopUpdatingLocation];



另外,注意不要调用locationManager对象,否则你的应用程序将崩溃



如果它仍然不停止位置服务,那么有解决方案,只是使用BOOL变量,如果你不想使用它在未来。



希望这有助于您!


I am working on map application,

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

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

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

解决方案

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

You need to release your location manager, for that set

locationManager = nil;

This should be written after

[locationManager stopUpdatingLocation];

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

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

hope this helps you!

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

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