好的,我现在有一个应用程序,在这个应用程序中,我使用CLLocationManager startMonitoringForRegion方法注册了一个要监视的地理信息。当应用程序位于前台和后台时,这很好。
我还设置了适当的plist值:
UIBackgroundModes :{location}
UIRequiredDeviceCapabilities: {location-services}什么不起作用
设备重新启动后,应用程序将不会重新启动。如果在输入背景之前设置startMonitoringSignificantLocationChanges,我可以强制这样做。但是这种方法使用的电池寿命要长得多,而且我并不总是需要定位,只是在我破坏地理位置的时候。
各地区的医生说:
In iOS, the regions you register with the location manager persist between launches of your application. If a region crossing occurs while your iOS app is not running, the system automatically wakes it up (or relaunches it) in the background so that it can process the event. When relaunched, all of the regions you configured previously are made available in the monitoredRegions property of any location manager objects you create.
问题
在不使用startMonitoringSignificantLocationChanges的情况下,(在使用地理区域时)系统在系统重新启动后重新启动我的应用程序是否可能?
编辑:我的目标是iOS6 & iOS7
发布于 2013-12-11 00:46:58
在这里回答我自己的问题。
虽然您确实需要使用startMonitoringSignificantLocationChanges使系统在设备重新启动后唤醒应用程序。如果用户强行关闭了应用程序,什么也不会唤醒它。
出于我的目的,我不需要将UIBackgroundModes设置为location。此设置通常用于只需要细粒度位置更新(例如使用startUpdatingLocation)的应用程序。使用startMonitoringSignificantLocationChanges时不需要设置后台模式。
https://stackoverflow.com/questions/20432971
复制相似问题