答案 0 :(得分:7)
您可以在Xcode项目的Info.plist中添加说明。
<key>NSLocationAlwaysUsageDescription</key>
<string>The applicaiton requires location services to workss</string>
见下图
见下面的结果
答案 1 :(得分:1)
您可以在info.plist
<key>NSLocationAlwaysUsageDescription</key>
<string>This application requires location services to work</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>This application requires location services to work</string>
并检查位置服务权限。
if([CLLocationManager locationServicesEnabled]){
NSLog(@"Location Services Enabled");
if([CLLocationManager authorizationStatus]==kCLAuthorizationStatusDenied){
alert = [[UIAlertView alloc] initWithTitle:@"App Permission Denied"
message:@"To re-enable, please go to Settings and turn on Location Service for this app."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
}
}
答案 2 :(得分:1)