I'm trying to use significant change location monitoring in iOS 8, but the didUpdateLocations method is never called. Here is the code for setting up the location manager:
- (void)viewDidLoad
{
[super viewDidLoad];
CLLocationManager *locationManager = [[CLLocationManager alloc] init];
locationManager.delegate = self;
[locationManager requestWhenInUseAuthorization];
[locationManager startMonitoringSignificantLocationChanges];
}
Despite calling requestWhenInUseAuthorization
, nothing pops up to ask the user to authorize it. I have set NSLocationWhenInUseUsageDescription, and it still does not work. didChangeAuthorizationStatus
and didFailWithError
are also never called.
EDIT: I was able to get it to ask the user to allow location services, but even if you click allow it never shows the location.
Try
Background mode on in capabilities
#import <CoreLocation/CoreLocation.h>
<CLLocationManagerDelegate>
locationManager = [[CLLocationManager alloc] init]; [locationManager setDelegate:(id)self]; [locationManager requestWhenInUseAuthorization];
Thats in the beginning of app
NSLocationWhenInUseUsageDescription
in plistTry to CMD + SHIFT + K
Try to turn off iPhone and then turn on - he had some cash in iOS 8 - so after 5 times - app don't ask permission to Core Location - that helped me
I had a similar problem migrating my app to iOS 8. As the original code as based on sample code provided by Apple https://developer.apple.com/library/ios/samplecode/GeocoderDemo/Introduction/Intro.html I checked if it had been updated and it had. The main difference is in this function the bit relevant to iOS 8, has been commented. This worked for me.