我在iOS 10上使用的代码在iOS 11上不再起作用...有什么建议需要更改吗?我需要打开蓝牙设置而不是通用iOS设置,因为下面的代码打开了通用iOS设置。
if let settings = URL(string: "App-Prefs:root=Bluetooth") {
UIApplication.shared.open(settings, options:[:], completionHandler:nil)
}
我在iOS 10上使用的代码在iOS 11上不再起作用...有什么建议需要更改吗?我需要打开蓝牙设置而不是通用iOS设置,因为下面的代码打开了通用iOS设置。
if let settings = URL(string: "App-Prefs:root=Bluetooth") {
UIApplication.shared.open(settings, options:[:], completionHandler:nil)
}
iOS 11及以后的版本,苹果建议使用公共API或删除使用“prefs:root”或“App-Prefs:root”URL方案的功能,因为这是私有实体。
如果您使用上述URL方案,则您的应用程序可能会被拒绝。如果您想打开应用程序设置,请使用UIApplicationOpenSettingsURLString。