// 更新ios8 后可以直接跳转到应用隐私设置
UIApplication.shared.openURL(URL(string:UIApplicationOpenSettingsURLString)!)
跳转方法
/**
打开系统设置 等open
@param scheme <#scheme description#>
*/
-(void)openSysScheme:(NSString*)scheme{
UIApplication *application = [UIApplication sharedApplication];
NSURL *URL = [NSURL URLWithString:scheme];
if ([application respondsToSelector:@selector(openURL:options:completionHandler:)]) {
[application openURL:URL options:@{}
completionHandler:^(BOOL success) {
NSLog(@"Open %@: %d",scheme,success);
}];
} else {
BOOL success = [application openURL:URL];
NSLog(@"Open %@: %d",scheme,success);
}
}
func openSysSeting(type:openSysSetingType){
switch type {
case .photoPrivacy:// 相册的隐私设置
if #available(iOS 10.0, *) {
// UIApplication.shared.open(URL(string:"App-prefs:root=Photos")!)
UIApplication.shared.open(URL(string:"App-prefs:root=Privacy&path=PHOTOS")!, options: [:], completionHandler: { (bool) in
})
} else {
UIApplication.shared.openURL(URL(string:"prefs:root=Privacy&path=PHOTOS")!)
// Fallback on earlier versions
}
default:
break
}
}
From: http://noahzy.com/ji-lu-settingde-tiao-zhuan-url/
记录下各个页面的跳转URL Scheme,方便以后查询
IOS 10 后
"App-prefs:root=Privacy&path=CAMERA"
WIFI prefs:root=WIFI 个人热点 prefs:root=INTERNET_TETHERING 蜂窝设置 prefs:root=MOBILE_DATA_SETTINGS_ID 隐私 prefs:root=Privacy 隐私-相机 prefs:root=Privacy&path=CAMERA 隐私-相册 prefs:root=Privacy&path=PHOTOS 隐私-定位服务 prefs:root=LOCATION_SERVICES 通用 prefs:root=General&path VPN prefs:root=VPN 关于 prefs:root=General&path=About
辅助功能 prefs:root=General&path=ACCESSIBILITY 飞行模式 prefs:root=AIRPLANE_MODE 自动锁屏时间 prefs:root=General&path=AUTOLOCK 用量 prefs:root=General&path=USAGE 亮度 prefs:root=Brightness 蓝牙 prefs:root=General&path=Bluetooth 日期和时间 prefs:root=General&path=DATE_AND_TIME Facetime设置 prefs:root=FACETIME 键盘设置 prefs:root=General&path=Keyboard Icloud prefs:root=CASTLE 备份 prefs:root=CASTLE&path=STORAGE_AND_BACKUP 语言与地区设置 prefs:root=General&path=INTERNATIONAL 账户设置 prefs:root=ACCOUNT_SETTINGS 音乐 prefs:root=MUSIC EQ均衡器 prefs:root=MUSIC&path=EQ 设置 prefs:root= 备忘录 prefs:root=NOTES 通知 prefs:root=NOTIFICATIONS_ID 电话设置 prefs:root=Phone 照片与相机设置 prefs:root=Photos 还原 prefs:root=General&path=Reset 铃声设置 prefs:root=Sounds&path=Ringtone Safari prefs:root=Safari 声音 prefs:root=Sounds 系统更新 prefs:root=General&path=SOFTWARE_UPDATE_LINK STORE 设置 prefs:root=STORE 视频设置 prefs:root=VIDEO 壁纸设置 prefs:root=Wallpaper
2018-6-20 更新
苹果不让用这个私有方式了
From: https://www.jianshu.com/p/a94cd8103bba
例如跳转Wi-Fi,之前是使用prefs:root=WIFI来进行跳转
eg:
//iOS10
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"] options:@{} completionHandler:nil];
//
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=WIFI"]];
这样在上架的时候会悲剧
中间进行一个转码,绕过苹果的代码扫描,亲测能过审核.
//将上面的跳转字符串转成字符,在进行拼接就好了
NSData *encryptString = [[NSData alloc] initWithBytes:(unsigned char []){0x70,0x72,0x65,0x66,0x73,0x3a,0x72,0x6f,0x6f,0x74,0x3d,0x4e,0x4f,0x54,0x49,0x46,0x49,0x43,0x41,0x54,0x49,0x4f,0x4e,0x53,0x5f,0x49,0x44} length:27];
NSString *string = [[NSString alloc] initWithData:encryptString encoding:NSUTF8StringEncoding];
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:string] options:@{} completionHandler:nil];
swift
let dataString = Data.init(bytes: [0x70,0x72,0x65,0x66,0x73,0x3a,0x72,0x6f,0x6f,0x74,0x3d,0x50,0x72,0x69,0x76,0x61,0x63,0x79,0x26,0x70,0x61,0x74,0x68,0x3d,0x50,0x48,0x4f,0x54,0x4f,0x53])
let string = String.init(data: dataString, encoding: String.Encoding.utf8)
给一个转换的网站
http://www.ab126.com/goju/1711.html
一般ios 8 都用新的方式了, ios7 就这个转码吧
文章评论