首页 > 移动平台 > 详细

ios简单实现如果没有开启定位,提示开启系统软件定位功能

时间:2016-12-15 14:38:36      阅读:189      评论:0      收藏:0      [点我收藏+]

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

          }

      }

}

ios简单实现如果没有开启定位,提示开启系统软件定位功能

原文:http://www.cnblogs.com/sunfuyou/p/6182863.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!