美文网首页
iOS10 APP内跳转至系统设置(如WIFI,Bluetoot

iOS10 APP内跳转至系统设置(如WIFI,Bluetoot

作者: 小虎哥 | 来源:发表于2016-12-16 17:01 被阅读152次
  • 在iOS 10之前跳转到系统设置:
  • 在项目中的info中添加 URL types 设置URL Schemes 为 prefs
    然后在需要跳转时(如跳转蓝牙,只需下面代码):
NSURL *url = [NSURL URLWithString:@"prefs:root=Bluetooth"];
if ([[UIApplication sharedApplication] canOpenURL:url]) {
        [[UIApplication sharedApplication] openURL:url];
 }
  • 但是iOS 10之后不能用了,都说被苹果禁用了,实际上我们只需要把prefs:root=Bluetooth改为app-Prefs:root=Bluetooth

相关文章

网友评论

      本文标题:iOS10 APP内跳转至系统设置(如WIFI,Bluetoot

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