如何判断我的应用程序是否启用了位置服务?
我有两个故事板,我想查看定位服务.如果为我的应用程序启用了位置服务,我想启动带有位置的 map 故事板.否则,我想启动另一个故事板.我如何以编程方式完成?
如何判断我的应用程序是否启用了位置服务?
我有两个故事板,我想查看定位服务.如果为我的应用程序启用了位置服务,我想启动带有位置的 map 故事板.否则,我想启动另一个故事板.我如何以编程方式完成?
这是正确的.
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];
}
}