通过弹出通知以编程方式打开Wifi设置

时间:2018-11-13 09:42:51

标签: ios swift unusernotificationcenter

我正在使用下面的代码段,但似乎没有打开“设置”,而是打开了应用程序的“通知”设置。

我需要打开wifi设置以使用户能够将其关闭,iOS 12,Swift 4.2

{

    if response.actionIdentifier == "action1" {
        guard let settingsUrl = URL(string: UIApplication.openSettingsURLString) else {
            return
        }

        if UIApplication.shared.canOpenURL(settingsUrl) {
            UIApplication.shared.open(settingsUrl, completionHandler: { (success) in
                print("Settings opened: \(success)") // Prints true
            })
        }
    }
}

1 个答案:

答案 0 :(得分:0)

打开设置,不打开wifi设置。当我直接从我的应用程序打开wifi设置时,我的应用程序被拒绝了一次。避免使用私有API,Apple可能会拒绝您的应用。