gpt4 book ai didi

swift3 - 如何在 Swift 3 中打开 WIFI 设置

转载 作者:行者123 更新时间:2023-12-04 22:57:25 26 4
gpt4 key购买 nike

我想从我的 iOS 应用程序打开 WIFI 设置部分,我的代码在 Swift 3 和 iOS 9.2 之前运行良好

if let settingsURL = URL(string: AppSettingsWifiUrl) {
UIApplication.shared.openURL(settingsURL)
}

但是更新后它不适用于 Xcode 8 + Swift 3 + iOS 10,有人可以帮忙吗?

最佳答案

我们不能再在 iOS 11 上这样做了,我们可以打开设置:

if let url = URL(string:UIApplicationOpenSettingsURLString) {
if UIApplication.shared.canOpenURL(url) {
let url = UIApplication.shared.open(url, options: [:], completionHandler: nil)
}
}

关于swift3 - 如何在 Swift 3 中打开 WIFI 设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39764553/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com