11

Based on this example application and this Stackoverflow post: Periodic iOS background location updates, I have managed to create a working implementation for periodic background location tracking.

Everything works well on the device and I install the application from Xcode, but to every tester I send the application to via crashlytics the app still times out in the background.

Does it have to do anything with debug/release mode or provisioning profiles?

Community
  • 1
  • 1
Zoltan Varadi
  • 2,468
  • 2
  • 34
  • 51

2 Answers2

1

You have to use applicationDidEnterBackground method to get update location in background mode. I have download your source from github, in this there is no implemented in below method :

- (void)applicationDidEnterBackground:(UIApplication *)application
{
}

You have to use like this :

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    [self.shareModel.anotherLocationManager stopMonitoringSignificantLocationChanges];

    if(IS_OS_8_OR_LATER) {
        [self.shareModel.anotherLocationManager requestAlwaysAuthorization];
    }

    [self.shareModel.anotherLocationManager startMonitoringSignificantLocationChanges];
}

For more details you can refer the link : http://mobileoop.com/getting-location-updates-for-ios-7-and-8-when-the-app-is-killedterminatedsuspended

BKjadav
  • 543
  • 2
  • 16
0

Hi have you tried the following in Appdelegate?

- (void)applicationWillResignActive:(UIApplication *)application
{
     [locationManager startUpdatingLocation];
     //`locationManager` is object of `CLLocationManager` 
}
Julian E.
  • 4,687
  • 6
  • 32
  • 49
iOS Dev
  • 195
  • 9