升级到ios10后,我不再使用设置wifi页面,而是得到一个消息- canopenurl:失败的URL:“prefs:root= wifi”-错误:“操作无法完成。(OSStatus错误-10814)。”
我很幸运地得到了解决方案。使用App-Prefs代替prefs。
if let url=URL(string:"App-Prefs:root=WIFI") {
if UIApplication.shared.canOpenURL(url) {
if #available(iOS 10.0,*) {
UIApplication.shared.open(url, options: [:], completionHandler: nil)
}else{
UIApplication.shared.openURL(url)
}
}
}
//Other URLs:
App-Prefs:root=WIFI
App-Prefs:root=Bluetooth
App-Prefs:root=MOBILE_DATA_SETTINGS_ID
App-Prefs:root=INTERNET_TETHERING
App-Prefs:root=Carrier
App-Prefs:root=NOTIFICATIONS_ID
App-Prefs:root=General
App-Prefs:root=General&path=About
App-Prefs:root=General&path=Keyboard
App-Prefs:root=Wallpaper
App-Prefs:root=SIRI
App-Prefs:root=Privacy
App-Prefs:root=SAFARI
App-Prefs:root=MUSIC
App-Prefs:root=MUSIC&path=com.apple.Music:EQ
App-Prefs:root=Photos
网友评论