So I recently updated to the latest Parse SDK that's compatible with iOS 8 and I add the two keys NSLocationWhenInUseUsageDescription and NSLocationAlwaysUsageDescription...but for some reason [PFGeoPoint geopointForCurrentLocationInBackground] is not being called....and I don't understand why.
and here is a snippet of the code:
[PFGeoPoint geoPointForCurrentLocationInBackground:^(PFGeoPoint *geoPoint, NSError *error) {
if(!error){
NSLog(@"Got current geopoint!");
....
else{
UIAlertView *errorAlert = [[UIAlertView alloc]initWithTitle:@"Oops!" message:[error description] delegate:self cancelButtonTitle:nil otherButtonTitles:@"Okay", nil];
[errorAlert show]; }
}];
Can someone help please?
[PFGeoPoint geopointForCurrentLocationInBackground]
will only be called if you have first called yourCLLocationManager
engaged and have asked the user for permission to show their location.You also need to update the
(void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
method for iOS 8.Something like this is what I use:
You also need to implement the locationmanager delegate method to handle changes is location authorization status, like so: