if([CLLocationManager locationServicesEnabled]){
self.locationManage = [[[CLLocationManager alloc] init] autorelease];
self.locationManage.delegate = self;
self.locationManage.distanceFilter = 200;
self.locationManage.desiredAccuracy = kCLLocationAccuracyBestForNavigation;//kCLLocationAccuracyBest;
if (SYSTEM_VERSION >= 8.0) {
//使用期间
[self.locationManage requestWhenInUseAuthorization];
//始终
//or [self.locationManage requestAlwaysAuthorization]
}
}
- (void)locationManager:(CLLocationManager *)manager didChangeAuthorizationStatus:(CLAuthorizationStatus)status
{
switch (status) {
case kCLAuthorizationStatusNotDetermined:
if ([self.locationManage respondsToSelector:@selector(requestAlwaysAuthorization)])
{
[self.locationManage requestWhenInUseAuthorization];
}
break;
default:
break;
}
}原文:http://blog.csdn.net/nextstudio/article/details/40050095