CoreLocation 图标停留在状态栏中
我有一个链接到静态库的应用程序。在静态库内部,有一个 CLLocationManager 负责获取设备的坐标,但是,我注意到一些奇怪的行为。一旦应用程序完全退出(不再后台),指南针图标将保留在状态栏中。我相信,由于罗盘图标保留在状态栏中,因此设备的 GPS 无线电仍然打开,轮询设备的位置。
从设备中删除应用程序后,该图标就会消失。这是一个错误吗?
I have an application that is linking to a static library. Inside of the static library, there's a CLLocationManager that is in charge of getting the device's coordinates, however, I'm noticing some strange behavior. Once the application is completely exited (no longer backgrounding), the compass icon stays in the status bar. I believe since the compass icon is remaining in the status bar, the device's GPS radio is still on, polling for the device's location.
Once I remove my application from the device, the icon disappears. Is this a bug?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
你知道图书馆里发生了什么吗?
如果使用重要位置更新服务或区域监控服务,则该行为是正常的。这些服务实际上会导致您的应用程序在收到事件时在后台启动(如果它尚未处于挂起状态)。
更新:请注意,当您在 Xcode 中调试应用程序时进入后台时,核心位置图标会保留在状态栏中。原因是您的应用程序在调试会话处于活动状态时不会被暂停。
Do you know what's going on in the library?
The behavior would be normal if the significant location update service or the region monitoring service are used. These services actually cause your app to be started in the background (if it's not already in suspended state) when an event is received.
Update: Be aware that the Core Location icon stays in the status bar when you're going to the background while debugging the app in Xcode. Reason being your app doesn't get suspended while a debug session is active.