应用程序终止后 CLLocationManager 仍处于活动状态
我通过在 plist 文件中设置“必需的后台模式”标志来尝试在后台运行 CLLocationManager,它确实有效,问题是在我终止应用程序(在任务管理器中关闭它)后,位置图标(状态栏上的三角形)仍然显示向上。删除应用程序后,位置图标消失。我想知道的是我是否需要对这种背景位置进行特殊清理?
I experimented CLLocationManager that run in background by setting "Required background modes" flag in plist file and it does work, the problem is after I terminated the app (close it in task manager) the location icon (triangle on the status bar) still showing up. After I delete the app the location icon disappear. What I want to know is do I need special clean up for this kind of background location ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
三角形并不意味着 cllocationmanager 处于活动状态。它仅显示应用程序请求了您设备的位置服务,并且如果应用程序想要访问,则位置服务处于开启状态(可访问)。这并不意味着 GPS 仍然开启。如果您的应用程序已关闭,但电池电量很快耗尽,只有这样才意味着 GPS 处于活动状态。即使如此,您也不必担心,因为其他一些应用程序可能正在使用 GPS。
删除应用程序后它就会消失,因为操作系统保留了过去 24 小时内请求位置服务的应用程序的记录,如果找到这样的应用程序,则会显示紫色三角形。当您删除应用程序时,操作系统找不到记录,因此三角形消失。
The triangle doesnt mean that cllocationmanager is active. It only shows that your device's location services were requested by an app and that location services are ON (accessible) if an app wants to access. It doesnt mean that gps is still on. If your app is closed but the the battery is getting drained pretty quick, only then it means that gps is active. Even then you dont need to worry about it because some other app may be using gps.
It goes away after deleting the app because the os maintains a record of apps that requested location services within last 24 hrs and if it finds such an app then it displays the purple triangle. When you delete the app, the os cant find a record and hence the triangle goes away.
后来发现是iphone的问题。在“设置”中重置位置警告后,一切都按我的预期进行。
It turn out that it was a problem on iphone. After reset location warning in Settings everything work as I expected.