ios定位权限申请与提醒

//TODO: 此处可以用一个提醒框来处理
//如果没给权限:显示提醒

if ([CLLocationManager locationServicesEnabled] && ([CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorizedWhenInUse   || [CLLocationManager authorizationStatus] == kCLAuthorizationStatusAuthorized)) {

    //定位功能可用
    shareLocationUploadManager = [DRuploaddataAndLocationManager shareManager];



}else if ([CLLocationManager authorizationStatus] ==kCLAuthorizationStatusDenied) {

    //定位不能用

    [self showAlertWithTitle:@"请求打开定位权限" Message:@"" CancelTitle:@"不定位" OthersTitles:@[@"定位"] ConfirmHandel:^(NSInteger index) {

        if (index==1) {
            NSURL * url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];

            if([[UIApplication sharedApplication] canOpenURL:url]) {
                [[UIApplication sharedApplication] openURL:url];

            }

        }
    }];



}else if([CLLocationManager authorizationStatus] == kCLAuthorizationStatusNotDetermined){
    [self showAlertWithTitle:@"请求定位权限" Message:@"" CancelTitle:@"取消" OthersTitles:@[@"确定"] ConfirmHandel:^(NSInteger index) {

        if (index==1) {
            shareLocationUploadManager = [DRuploaddataAndLocationManager shareManager];

        }else{

        }

    }];
}
全部评论

相关推荐

dao_yi:投了1000个左右,回消息的很少,要简历然后说过几天联系的都没有消息了,约面试的基本都是3000左右,足够在当地生活,最后去了一个武汉的3000,干了两天回来考研了,感觉这个行业加班是常态,看能不能考研上岸找个国企,或者大厂。
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务