简体   繁体   中英

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.

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];
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM