if([CLLocationManager locationServicesEnabled] && [CLLocationManager authorizationStatus] == kCLAuthorizationStatusDenied) {//判斷該軟件是否開啟定位
JJLog(@"沒打開");
self.isAddress = YES;
UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"打開定位開關" message:@"請點擊設置打開定位服務" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"設置", nil];
[alertView show];
}else{
JJLog(@"打開");
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if (buttonIndex == 1) {
NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
[[UIApplication sharedApplication] openURL:url];
}
}
}
