iOS10跳转系统设置的正确姿势

在iOS10更新后,系统设置跳转被禁用,只能跳转App设置? NO, NO, NO, 看这里,又可以换个姿势愉快的跳转啦。

其实方法很简单,例如原有跳转Wi-Fi设置是"prefs:root=WIFI",新的写法是"App-Prefs:root=WIFI"。怎么样,是不是很简单!!!

在非iOS10手机中,也可以用此方法进行跳转,但不保证跳转正确性

非iOS10系统跳转,可以参考这里(未测试)

Objective-c

#define iOS10 ([[UIDevice currentDevice].systemVersion doubleValue] >= 10.0)
NSString * urlString = @"App-Prefs:root=WIFI";
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:urlString]]) {
    if (iOS10) {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString] options:@{} completionHandler:nil];
    } else {
        [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
    }
}

Swift

if let url = URL(string:"App-Prefs:root=WIFI") {
      if #available(iOS 10.0, *) {
            UIApplication.shared.open(url, options: [:], completionHandler: nil)
      } else {
            UIApplication.shared.openURL(url)
      }
}

当前iOS10支持的所有跳转,亲测可用(测试系统:10.2.1)

跳转 写法
无线局域网 App-Prefs:root=WIFI
蓝牙 App-Prefs:root=Bluetooth
蜂窝移动网络 App-Prefs:root=MOBILE_DATA_SETTINGS_ID
个人热点 App-Prefs:root=INTERNET_TETHERING
运营商 App-Prefs:root=Carrier
通知 App-Prefs:root=NOTIFICATIONS_ID
通用 App-Prefs:root=General
通用-关于本机 App-Prefs:root=General&path=About
通用-键盘 App-Prefs:root=General&path=Keyboard
通用-辅助功能 App-Prefs:root=General&path=ACCESSIBILITY
通用-语言与地区 App-Prefs:root=General&path=INTERNATIONAL
通用-还原 App-Prefs:root=Reset
墙纸 App-Prefs:root=Wallpaper
Siri App-Prefs:root=SIRI
隐私 App-Prefs:root=Privacy
Safari App-Prefs:root=SAFARI
音乐 App-Prefs:root=MUSIC
音乐-均衡器 App-Prefs:root=MUSIC&path=com.apple.Music:EQ
照片与相机 App-Prefs:root=Photos
FaceTime App-Prefs:root=FACETIME
  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值