Problem
In iOS 6 Apple has made breaking changes to Core Location by implementing the AutoPause API. The AutoPause API pauses the location updates when an application goes into the background and applies to a couple of criteria (i.e. user not moving, no location fix, user discontinues activity). To accurately handle pause events Apple requests to help better predicting whether or not to pause location updates setting an activity type (i.e. navigation, fitness, other).
The AutoPause API is enabled by default when an application is compiled against iOS 6.
The problem is that at this moment we, Appcelerator Mobile developers, are not able to configure the AutoPause API and updates are always paused when going into the background, even when UIBackgroundModes is set to location and the application is allowed to keep running in the background for longer then 10 minutes. This breaks the working of any tracking or navigation app and renders it useless.
The easy fix is to disable the AutoPause API for now by always setting 'pausesLocationUpdatesAutomatically' to NO. Location updates will be send even when the app goes in the background, like it used to work in < iOS 6. Hopefully this could be implemented in the 2.1.3 GA release, so we can resubmit our app to the App Store.
The best case scenario is to implement the AutoPause API by adding pausesLocationUpdatesAutomatically and activityType properties (CLLocationManager.h), the CLActivityType constants (CLLocationManager.h) and the pause event listeners (CLLocationManagerDelegate.h) to Ti.Geolocation(.iPhone)
Test case
A test application compiled against iOS6 implementing Ti.Geolocation tracking will receive no updates when going into background. Our application did receive a location update every 4 to 5 minutes with horrible accuracy (1000s of meters)
References
WWDC 2012 video explaining the AutoPause API:
https://developer.apple.com/videos/wwdc/2012/?include=303#303
WWDC 2012 Slides explaining the AutoPause API:
http://adcdownload.apple.com//wwdc_2012/wwdc_2012_session_pdfs/session_303__staying_on_track_with_location_services.pdf
CLLocationManager Class Reference (pausesLocationUpdatesAutomatically and activityType properties):
http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html
CLLocationManagerDelegate protocol reference (pause eventlisteners):
http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManagerDelegate_Protocol/CLLocationManagerDelegate/CLLocationManagerDelegate.html
Test case
Any progress? We currently have a non working app in the app store, which we can't update because we're waiting on this fix. What is necessary to properly test this feature and what can we do to help?
Will revisit the ticket after 6.1.0 is out officially
New PR is up https://github.com/appcelerator/titanium_mobile/pull/3963
Tested and verified fix with: Titanium Studio, build: 3.1.0.201303182358 Titanium SDK, build: 3.1.0.v20130319225749 XCode 4.6 Device: iPhone5 iOS 6.1.2 Following Testing instructions, results as expected.