Jugal K Balara
Jugal K Balara

Reputation: 927

CLLocationManager authorization message not show in ios iOS 8.0.1

CLLocationManager authorization message not show when i start application i have checked in location service inside device application show but don't have permission.

All things are working fine in ios 7 with xcode 5.1 but issue in Xcode 6.0 with ios 8.0

self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self;
self.locationManager.distanceFilter = kCLDistanceFilterNone;
self.locationManager.desiredAccuracy = kCLLocationAccuracyBest;

if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])
{
    [self.locationManager requestWhenInUseAuthorization];
}
[self.locationManager startUpdatingLocation];

Thanks.

Upvotes: 0

Views: 187

Answers (1)

Anil Varghese
Anil Varghese

Reputation: 42977

In iOS8 you have to request the user to authorize the access by using requestWhenInUseAuthorization or requestAlwaysAuthorization.

And you have add either of the keys NSLocationWhenInUseUsageDescription or NSLocationAlwaysUsageDescription with proper messages to the info.plist

if ([self.locationManager respondsToSelector:@selector(requestWhenInUseAuthorization)])
{
   [self.locationManager requestWhenInUseAuthorization];
}

Upvotes: 4

Related Questions