I have a problem with the SignificantLocationChanges
since the release of iOS 8. The method
[locationManager startMonitoringSignificantLocationChanges];
is called correctly after checking for availability, the delegates also work nice (I check it with the didChangeAuthorizationStatus
method, which is part of the same delegate and object) and compiler has no doubts, but there comes absolutely no updates and no errors from the didFailWithError
method. The log says the authorizationStatus is 4, which is ok I think.
Before iOS 8 this all works fine.
The first test-device (iPad 2 with 3G) runs iOS 7.1.2 the second (iPhone 5) 8.0.2, when I use the normal startUpdatingLocation
method I get updates immediately. But SignificantLocationChanges
would be much better for my work. Has anyone an idea where the error could be?
Answer
In iOS 8 You must request authorization with type "Always" to allow your app to use significant locations.
Add a new row in your -Info.plist file with key NSLocationAlwaysUsageDescription
Then request authorization if its not requested yet.
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
if (status == kCLAuthorizationStatusNotDetermined && [manager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[manager requestAlwaysAuthorization];
}
}
No comments:
Post a Comment