如何检查我的应用是否启用了定位服务?
我有 2 个 Storyboard,我想检查定位服务。如果为我的应用启用了位置服务,我想启动带有位置的 map Storyboard。否则,我想启动另一个 Storyboard。如何以编程方式进行?
最佳答案
这是正确的。
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];
}
}
关于ios - 在 iOS 上检查位置服务权限,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15153074/