gpt4 book ai didi

ios - CLLocationManager 不要停止

转载 作者:可可西里 更新时间:2023-11-01 04:32:02 26 4
gpt4 key购买 nike

尊敬的开发人员,

我正在努力为我的 CLLocationManager 重新加注问题找到解决方案。

我在我的应用程序中使用了一个 CLLocationManager 实例。如果用户选择设备上的主页按钮或终止应用程序,我希望定位服务停止。

为此,我调用了 [self.locationManager stopUpdatingLocation]; - 但这不知何故不起作用。应用程序进入后台,状态栏右上角位置小箭头没有消失。即使我添加 [self.locationManager release]self.locationManager.delegate = nil; - 位置跟踪也不会停止 :-/

只有当我进入我的设备设置并关闭该应用程序的位置服务时,它才会消失。每当我切换回启用定位服务时,我会立即在切换开关旁边看到一个紫色箭头,并且该图标会重新出现在状态栏中。

我的问题是如何在应用进入后台或终止时关闭定位服务?

提前致谢,祝您有愉快的一天:-)

最佳答案

您的位置已禁用。位置服务图标“含义”在 iOS 5 上发生了变化。看看这个问题:https://apple.stackexchange.com/questions/27463/why-is-the-location-services-icon-always-present

我引用答案:

It's a new feature in ios 5 called "region Monitoring"

The reason it's active even if the app is closed is that this feature runs in iOS 5 core and notifies all apps that are registered when they have entered or left a specific geo-fence.

Reminders does that when you use a location based reminder.

Although the location icon appears at all time. This actually has very minimal impact on the battery due to apple really optimizing this feature by using cell and wifi mostly.

您的应用运行正常。系统行为是改变的。

关于ios - CLLocationManager 不要停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8155456/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com