2

我需要打开蓝牙设置菜单IOS9.0。接下来打开设置菜单OK!,

UIApplication.sharedApplication().openURL(NSURL(string: UIApplicationOpenSettingsURLString)!)

但我需要打开蓝牙设置菜单尝试过

UIApplication.sharedApplication().openURL(NSURL(string: "prefs:root=General&path=Bluetooth")!)

这没用

任何人都可以帮助我吗?

4

2 回答 2

6

路易斯实际上找到了答案,但我一开始就读过去了,因为我没有看到答案。

答: 转到您的 XCode 项目,在 Info -> URL Types 部分 -> URL Scheme 中的“prefs”下

在 IOS9 中:let url = NSURL(string: "prefs:root=Bluetooth")!

IOS8:let url = NSURL(string: "prefs:root=General&path=Bluetooth")!

于 2016-03-17T19:58:50.423 回答
-1

您无法在 iOS 10 中打开蓝牙设置。

这是我打开设置的建议(swift 3)

let url = URL(string: UIApplicationOpenSettingsURLString)!
UIApplication.shared.openURL(url)
于 2017-03-24T19:01:59.693 回答