iphone - didEnterRegion 当应用程序未运行时

标签 iphone ios location region

iOS5。我已经正确设置了 CLLocationManager,它会监听区域进入/退出。 一切正常。但是当我终止我的应用程序并进入一个区域时,我收到了一个本地通知(在 didEnterRegion 方法中定义)并且它再次启动了我的应用程序。这是标准行为还是有其他事情发生?我以为它会在后台启动应用程序,执行 didEnterRegion: 并在一段时间后再次杀死自己。我需要做的就是在 didEnterRegion 中进行 HTTP 调用:

有谁遇到过类似的事情吗?

最佳答案

这是预期的行为。 当您的应用程序未运行但已为您的应用程序注册地理围栏过境点时,它将启动并触发回调。 之后它不会被杀死,除非系统决定,它需要内存。

别担心,您的应用程序即使已经启动也会处于休眠状态,因此不会有速度/电池/等方面的损失。

查看文档:

Handling Boundary-Crossing Events for a Region

Every time the user’s current location crosses a boundary region, the system generates an appropriate region event for your app. If your app is already running, these events go directly to the delegates of any current location manager objects. If your app is not running, the system launches it in the background so that it can respond. Apps can implement the following methods to handle boundary crossings:

关于iphone - didEnterRegion 当应用程序未运行时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14404355/

相关文章:

jquery:延迟()+ window.location?

ios - Quettra Portrait如何获取未越狱的iOS设备上已安装的应用程序的列表?

iphone - UIViewController 的 View 可以包含另一个 UIView 对象吗?

iphone - 如何在未加入 iPhone Developer Program 的情况下在越狱的 iPhone 上构建和安装应用程序?

iphone - MKMapView使用名称在国家/地区上放置图钉

javascript - AppGyver - PhoneGap 删除加载过渡屏幕

ios - 在动画期间保持 CAShapeLayer 蒙版静态

iphone - 在 Objective-C 中跟踪类实例的最佳方法是什么?

java - 在手机上获取当前位置,不起作用? [安卓]

android - 该代码不断告诉我我需要更新Google Play服务。我该如何解决?