如何从 iPhone 后台更新位置
我正在制作一个应用程序,当用户按下主页按钮时,我需要从后台更新位置,我已经在 UIBackGroundModes 中的 info.plist 中添加了更新用户位置,请让我知道除此之外还有其他必须要做的事情我这样做,就像必须启动位置管理器进行更新,请帮助我
I am making an application in which i need to update the location from background when user presses the home button, i have already added in the info.plist in UIBackGroundModes for updateuserlocation, please let me know apart from this anything else is there that have to me do, like have to start location manager for updating please help me
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您想使用
CLLocationManager
并从应用程序委托applicationDidEnterBackground
中调用startUpdatingLocation
。然而,这将导致电池和设备的大量消耗。不推荐。相反,您可能应该使用
startMonitoringSignificantLocationChanges
来将位置检查保持在最低限度。It sounds like you want to use a
CLLocationManager
and callstartUpdatingLocation
from within the App DelegateapplicationDidEnterBackground
.However, this will cause a major drain on the battery & isn't recommended. Instead, you should probably use
startMonitoringSignificantLocationChanges
to keep the location checking at a minimum.