美文网首页iOS 开发 iOS进阶指南iOS Developer
app跳转到该app所在的设置页面

app跳转到该app所在的设置页面

作者: 小码农_gjw | 来源:发表于2016-06-13 12:09 被阅读199次

很多app在开发过程中,在访问位置信息,相册,相机,麦克风等功能的时候被用户拒绝访问了,下次用户使用该功能的时候我们需要提醒用户去设置页面打开该功能。

处理方式如下:

在项目中的info中添加 URL types

添加 URL Schemes 为 prefs的url

NSDictionary *infoDict = [[NSBundle mainBundle] infoDictionary];

NSString *boundleId = infoDict[@"CFBundleIdentifier"];

NSString*url = [NSString stringWithFormat:@"prefs:root=%@", boundleId];

if([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:url]]) {

        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:url]];

}

效果图如下:

相关文章

网友评论

    本文标题:app跳转到该app所在的设置页面

    本文链接:https://www.haomeiwen.com/subject/byjydttx.html