How to open WIFI setting in Swift 3

后端 未结 7 1691
离开以前
离开以前 2021-01-14 00:37

I want to open WIFI setting section from my iOS application, my code was working well before Swift 3 with iOS 9.2

if let settingsURL = URL(string: AppSetting         


        
7条回答
  •  说谎
    说谎 (楼主)
    2021-01-14 01:07

    We can't do this anymore on iOS 11, we can just open the settings :

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

提交回复
热议问题