Location service goes inactive on iPhone 5

Even my application is registering for location updates in the background.

In my code:

self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers; self.locationManager.distanceFilter = 2500; 

And I didn’t move anywhere. So, after exactly 15 minutes in the console log, I received this message “The location icon should now be in the“ Inactive ”state . From now on, my application does not work in the background.

This only happens on the iPhone 5.

@updated

Here is my code

 self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; [self.locationManager setPurpose:@"Enable Location service for \"My App\" to track your"]; self.locationManager.desiredAccuracy = kCLLocationAccuracyThreeKilometers; /* Notify changes when device has moved x meters. * Default value is kCLDistanceFilterNone: all movements are reported. */ self.locationManager.distanceFilter = 2500; [self.locationManager startUpdatingLocation]; 
+2
ios objective-c core-location cllocationmanager
source share
2 answers

Was your application in the background when the location service became inactive?

If you do not want to pause location updates in the background, you need to set pausesLocationUpdatesAutomatically flag,

 if ([self.locationManager respondsToSelector:@selector(pausesLocationUpdatesAutomatically)]) { self.locationManager.pausesLocationUpdatesAutomatically = NO; } 
+5
source share

Since iOS 6, Apple added @property(assign, nonatomic) BOOL pausesLocationUpdatesAutomatically to the CLLocationManager . The default value is YES . Change the value of this property to NO , and location tracking will not stop in the background.

+2
source share

All Articles