Friday, September 12, 2014

IPhone: IOS8 Error Trying to start MapKit location updates without prompting for location authorization

Here is my full code to get the MapKit Map View working in iOS8!
In your AppName-Info.plist Add a new row with the key name being:
NSLocationWhenInUseUsageDescription
And/Or
NSLocationAlwaysUsageDescription
With the value being a string of the message that you want to be displayed:
YourAppName would like to use your location.
In your header file. (I use App Name-Prefix.pch but YourViewController.h will work too)
#define IS_OS_8_OR_LATER ([[[UIDevice currentDevice] systemVersion] floatValue] >= 8.0)
self.locationManager = [[CLLocationManager alloc] init];
    if(IS_OS_8_OR_LATER) {
        [self.locationManager requestWhenInUseAuthorization];
        [self.locationManager requestAlwaysAuthorization];
    }

No comments:

Post a Comment