URL方案"打开设置"ios

Maa*_*eaL 20 xcode url-scheme ios ios7 ios8

我知道这个问题已被问过很多次了.答案说这在Xcode> 5.x中不可用.但我看到一些可以使用它的应用程序(转到设置)(iOS7).有没有办法做到这一点?它在Xcode 6中可用吗?Facebook 可以检测蜂窝数据和WiFi.

在此输入图像描述在此输入图像描述

Bal*_*ick 82

从iOS 8开始,可以通过以下方式启动直接打开"隐私"应用程序部分的"设置"应用程序:

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
Run Code Online (Sandbox Code Playgroud)

在Swift中:

if let settingsURL = NSURL(string: UIApplicationOpenSettingsURLString) {
    UIApplication.sharedApplication().openURL(settingsURL)
}
Run Code Online (Sandbox Code Playgroud)

在Swift 3.0中:

if let settingsURL = URL(string: UIApplicationOpenSettingsURLString + Bundle.main.bundleIdentifier!) {
    UIApplication.shared.openURL(settingsURL as URL)
}
Run Code Online (Sandbox Code Playgroud)

  • @Pei在url方案中指定你的app的bundle id:`[[UIApplication sharedApplication] openURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@ BundleID",UIApplicationOpenSettingsURLString]]]; (7认同)
  • 有谁知道如何打开设置应用程序而不是个人设置?Facebook做到了. (6认同)

小智 7

1.-添加URL类型 在此输入图像描述

2.-使用:

目标 - C.

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"prefs:root=General"]];
Run Code Online (Sandbox Code Playgroud)

迅速

 UIApplication.sharedApplication().openURL(NSURL(string: "prefs:root=General")!)
Run Code Online (Sandbox Code Playgroud)

3.-在此答案中找到其他路径:iOS启动设置 - >限制URL方案

  • 在iOS 10中破碎.有任何变通方法吗? (3认同)
  • 如其他答案中所述,将"prefs"替换为"App-Prefs"以使其在iOS 10中工作. (2认同)