1

我在 iOS 11 iPhone 上使用 NEHotspotConfigurationManager 连接到特定的 Wi-Fi 点,然后断开连接。

这是代码:

let domainName = ""
let hotspotSettings = NEHotspotHS20Settings.init(domainName: domainName, roamingEnabled: true)
let hotspotEAPSettings = NEHotspotEAPSettings()
hotspotEAPSettings.username = *****
hotspotEAPSettings.password = ******
hotspotEAPSettings.isTLSClientCertificateRequired = true
hotspotEAPSettings.supportedEAPTypes = [21]
hotspotEAPSettings.trustedServerNames = [""]
hotspotEAPSettings.ttlsInnerAuthenticationType = .eapttlsInnerAuthenticationMSCHAPv2
print(hotspotEAPSettings)
let hotspotConfig = NEHotspotConfiguration.init(hs20Settings: hotspotSettings, eapSettings: hotspotEAPSettings)
print( hotspotConfig.ssid)
NEHotspotConfigurationManager.shared.apply(hotspotConfig) {[unowned self] (error) in
    print(error?.localizedDescription as Any)// gives Error Domain=NEHotspotConfigurationErrorDomain Code=5 "invalid EAP settings." 
    print(error as Any)
    if let error = error {
        self.showError(error: error)
    } else {
        self.showSuccess()
    }
}

问题是:发生了什么?为什么它提示我错误“无效的 EAP 设置”,以及这个错误是什么意思?

4

1 回答 1

0

首先,我们必须将 .mobileconfig 文件中的证书保存到 $TeamID.com.apple.networkextensionsharing 组中的 iPhone 钥匙串中,同时在 xCode 功能中启用钥匙串访问组并将 $TeamID.com.apple.networkextensionsharing 添加到权利中。成功将证书保存到钥匙串后,它就可以工作了。

于 2018-07-31T09:06:18.590 回答