iOS 实现直接跳转打开定位

实现直接跳转打开定位

UIAlertView *alertView = [[UIAlertView alloc]initWithTitle:@"提示" message:@"请到设置->隐私->定位服务中开启【xxx APP】定位服务,以便于能够准确获得你的位置信息" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"设置",nil];
[alertView show];

-(void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{//点击弹窗按钮后
 	if (buttonIndex == 1) {//确定
		NSURL *url = [NSURL URLWithString:UIApplicationOpenSettingsURLString];
		if ([[UIApplication sharedApplication] canOpenURL:url]) {
			[[UIApplication sharedApplication] openURL:url];
		}
	}
}

你可能感兴趣的:(权限开启)