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];

          }

      }

}

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-10-21
  • 2022-01-04
  • 2021-05-18
  • 2021-12-07
  • 2022-12-23
  • 2021-06-01
猜你喜欢
  • 2022-12-23
  • 2021-07-07
  • 2021-04-27
  • 2022-12-23
  • 2021-09-06
  • 2022-12-23
  • 2021-10-06
相关资源
相似解决方案