2015-04-07 13:26:10.767 harita [1690:821533]尝试启动MapKit位置updates without prompting for location authorization. Must call -[CLLocationManager requestWhenInUseAuthorization] or -[CLLocationManager requestAlwaysAuthorization] first.
答案 0 :(得分:0)
在ios8中你必须写下面的代码
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.desiredAccuracy = kCLLocationAccuracyHundredMeters;
// Code to check if the app can respond to the new selector found in iOS 8. If so, request it.
if([self.locationManager respondsToSelector:@selector(requestAlwaysAuthorization)]) {
[self.locationManager requestAlwaysAuthorization];
// Or [self.locationManager requestWhenInUseAuthorization];
}
[self.locationManager startUpdatingLocation];
您还必须在plist文件中添加要为应用显示的NSLocationAlwaysUsageDescription和消息。