全部。
最近我被这个错误困住了。这是我的代码
if([CLLocationManager locationServicesEnabled]){
NSLog(@"Location Services Enabled");
// Switch through the possible location
// authorization states
switch([CLLocationManager authorizationStatus]){
case kCLAuthorizationStatusAuthorized:
NSLog(@"We have access to location services");
[self loadAnnotations];
MKCoordinateSpan span = MKCoordinateSpanMake(0.04, 0.04);
MKCoordinateRegion region = MKCoordinateRegionMake(locationManager.location.coordinate, span);
[_mapView setRegion:region animated:YES];
break;
case kCLAuthorizationStatusDenied:
NSLog(@"Location services denied by user");
[self loadAnnotations];
[_mapView setRegion:adjustedRegion animated:YES];
break;
case kCLAuthorizationStatusRestricted:
NSLog(@"Parental controls restrict location services");
[self loadAnnotations];
[_mapView setRegion:adjustedRegion animated:YES];
break;
case kCLAuthorizationStatusNotDetermined:
NSLog(@"Unable to determine, possibly not available");
[_mapView setRegion:adjustedRegion animated:YES];
[self repeatCheckLocation];
}
}
else{
// locationServicesEnabled was set to NO
NSLog(@"Location Services Are Disabled");
[self loadAnnotations];
[_mapView setRegion:adjustedRegion animated:YES];
}
这是一个定位应用程序,它调用用户周围的一些地方。它适用于除 6.1 之外的其他版本。每当我在 iOS 6.1 模拟器上运行我的代码时,我都会看到它在 kCLAuthorizationStatusNotDetermined 处停止。奇怪的是..它在我的测试设备上运行时工作,该设备是安装了 iOS 6.1 的 iphone4。我不知道什么时候出错了..任何帮助将不胜感激