【问题标题】:How to programmatically open the Bluetooth settings in iOS 11如何以编程方式在 iOS 11 中打开蓝牙设置
【发布时间】:2018-05-21 06:59:03
【问题描述】:

我用于 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】:

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

因此,如果您使用上述 url 方案,您的应用可能会被拒绝。如果要打开应用设置,请使用 UIApplicationOpenSettingsURLString

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-12-04
    • 2019-09-12
    • 1970-01-01
    • 2012-03-01
    • 1970-01-01
    • 1970-01-01
    • 2010-12-17
    • 1970-01-01
    相关资源
    最近更新 更多