-1
我正在使用下面的代码来显示用户在iOS 8.4中的当前位置。我想在iOS 8.4中获取用户的当前位置,但它不工作,我正在使用此代码
- (void)viewDidLoad
{
[super viewDidLoad];
[locationManager requestAlwaysAuthorization];
self.mapView.delegate = self;
[self.mapView setShowsUserLocation:YES];
locationManager = [[CLLocationManager alloc] init];
locationManager setDelegate:self];
[locationManager setDistanceFilter:kCLDistanceFilterNone];
[locationManager setDesiredAccuracy:kCLLocationAccuracyBest];
}
但它工作不正常。它显示以下错误:
Trying to start MapKit location updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first.
的可能的复制[iOS 8的requestWhenInUseAuthorization没有弹出](http://stackoverflow.com/questions/24850128/ios-8-requestwheninuseauthorization-no-popup) –