使用 NSUserDefaults 的后台位置设置问题
我将位置设置存储在设置包中。因此,当我将开关切换到“否”时,我的应用程序会停止后台定位服务。
我正在使用观察者来检测设置更改,并更新我的应用程序中的标志。问题是,如果我将开关切换到“关闭”,我的应用程序不会停止位置服务,直到我打开应用程序。这是可以理解的,因为我的观察者驻留在源代码中。有没有办法在应用程序处于后台时监听设置?我是一个iOS开发新手,所以不太了解后台和前台的概念。
I am storing Location settings in the settings bundle. So when I flip a switch to NO, my app stops the background location service.
I am using an observer to detect settings change, and updating a flag in my app. The problem is, if I flip the switch to OFF, my app does not stop the location service till I open the app. This is understandable, since my observer resides in the source code. Is there a way to listen for the settings while the app is in the background? I am an iOS development newbie, so I do not understand the concept of background and foreground so much.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现这是不可能的。
Its not possible is what I found.