iPhone-在背景模式下停用cllocationmanager事件
我有一个使用 CLLocationManager 接收位置和航向更新的应用程序。当应用程序发送到后台模式时,CLLocationManager 仍然接收事件(当应用程序不在屏幕上时在调试器中捕获)。
我是否有义务捕获“发送到后台”事件并使用 BOOL 退出事件委托方法以忘记这些更新,或停止/重新启动 CLLocationManager ?
或者是否有另一种解决方案可以在后台停止接收这些事件?
我想防止这种情况发生,不要执行无用的操作,并可能减少电池电量,因为我不需要这些事件。
我知道有一个 project.plist 参数可以设置为强制 iOS 继续向应用程序发送位置事件,即使它在后台也是如此。我没有设置该参数。所以我想有一种方法可以告诉iOS我不想在后台发生这些事件......
I have an app that uses the CLLocationManager to receive location and heading updates. When the app in sent to background mode, the CLLocationManager still receive events (catched in the debugger while the app is not onscreen).
Am I obliged to trap the "sent to background" event and use a BOOL to exit the event delegate method to forget those updates, or stop/restart the CLLocationManager ?
or is there another solution to stop receiving those events when in background ?
I'd like to prevent this not to do useless actions, and possibly reduce battery, as I don't need those events.
I know there is a project.plist param to set to force iOS to continue sending location events to the app even if it's in background. I didn't set that parameter. So I guess there is a way to tell iOS that I don't want those events when in background...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 UIApplicationDelegate 的以下方法:
Use next methods of
UIApplicationDelegate
: