监视区域,但当应用被杀死时,位置图标消失 [英] Monitoring regions but location icon disappears when app is killed

查看:116
本文介绍了监视区域,但当应用被杀死时,位置图标消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在singleton中包含一个CLLocationManager,并且添加了大约十二个要监视的区域.当应用程序位于前景/背景中时,我成功地收到了边界穿越的通知.但是,当我强制退出该应用程序时,位置图标消失了,并且没有收到任何回调.

I have a CLLocationManager contained in a singleton and I have added around a dozen regions to monitor. I am successfully notified of boundary crossings when the app is in the foreground/background. However, when I force quit the app, the location icon disappears and I am not getting any callbacks.

推荐答案

据我所知,这是自iOS7起的预期功能.这是我发现的类似问题的答复,在本例中,该问题涉及重大的位置更改: https://devforums.apple.com/message/882691#882691 :

As far as I can see, this is intended functionality as of iOS7. Here is a reply I found to a similar question, in this case involving significant location change: https://devforums.apple.com/message/882691#882691:

如果用户在应用程序切换器中向上滑动,则操作系统将不会启动应用程序,除非用户明确指示要这样做.因此,SLC将不会启动该应用程序,也不会发出静默通知.此时,将启动应用程序的唯一一件事就是用户点击图标.这里的意图是用户出于任何原因表达了他们选择不再运行该应用程序的选择,因此我们对此表示敬意. 在这种情况下,您实际上无能为力.下次用户启动该应用程序时,您可以让他们知道某些数据可能会丢失,尽管您实际上无法确定是否存在丢失的数据(即,您可能已经被后台的操作系统杀死了,并且用户可能尚未移动,因此不会触发任何SLC通知).我的建议是收集您可以在操作系统策略内获得的数据,如果用户手动杀死了该应用程序,则请遵守该愿望,不要执行任何操作. 无论如何,如果这种行为变化最终导致您或您的用户感到困惑,请随时提交错误报告.

If a user swipes up in the app switcher then the OS will not launch the app unless explicitly told to do so by the user. So no, SLC will not be launching the app, nor will silent notifications. The only thing that will launch the app at that point is the user tapping the icon. The intention here is that the user has expressed their choice of not having that app running any more for any reason, so we honor that. In this situation, there's really nothing that you can do. The next time the user launches the app you can let them know that some of the data may be missing, although you really cannot tell whether there's missing data or not (i.e. you might have been killed by the OS in the background and the user may not have moved thereby not triggering any SLC notifications). My suggestion would be to gather the data you can within the policies of the OS and if the user has manually killed the app then respect that wish and don't do anything. By all means, feel free to file a bug report if this change in behavior winds up causing problems for you or (especially) confusion for your users.

这篇关于监视区域,但当应用被杀死时,位置图标消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆