My app automatically wakes up after termination when new location data arrives on iOS 6, but not on iOS 7.
[[UIApplication sharedApplication] setBackgroundRefreshStatus]
is UIBackgroundRefreshStatusAvailable
.
In Info.plist
I set UIBackgroundModes
with value "location".
CLLocationManager
started this way:
- (void) start {
if (locationManaher == nil) {
locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
locationManager.desiredAccuracy = kCLLocationAccuracyNearestTenMeters;
}
[locationManager startMonitoringSignificantLocationChanges]
}
- (void) locationManager:(CLLocationManager *)manager didUpdateToLocation:(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation {
CLLocationCoordinate2D newCoordinate = newLocation.coordinate;
CLLocationCoordinate2D oldCoordinate = oldLocation.coordinate;
if (newCoordinate.latitude == oldCoordinate.latitude && newCoordinate.longitude == oldCoordinate.longitude) return;
float distance = [newLocation distanceFromLocation:oldLocation];
if (distance < distanceFilter) {
//send to server
}
}
Does anybody know where is a problem?