如何以编程方式在iOS 11中打开蓝牙设置

问题描述 投票:5回答:1

我用于iOS 10的代码不再适用于iOS 11 ...任何想法要改变什么?我需要打开蓝牙设置,而不是通过以下代码打开的常规iOS设置

if let settings = URL(string: "App-Prefs:root=Bluetooth") {
        UIApplication.shared.open(settings, options:[:], completionHandler:nil)
}
swift3 bluetooth settings ios11 swift4
1个回答
0
投票

从iOS 11开始,Apple建议使用公共API或使用“prefs:root”或“App-Prefs:root”URL方案删除功能,该方案是私有实体。

因此,如果您使用以上网址方案,您的应用可能会被拒绝。如果要打开应用程序设置,请使用UIApplicationOpenSettingsURLString。

© www.soinside.com 2019 - 2024. All rights reserved.