NEHotspotConfigurationErrorDomain 代码=5 "invalid EAP settings."
NEHotspotConfigurationErrorDomain Code=5 "invalid EAP settings."
我在 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()
}
}
问题是:发生了什么事?为什么提示我错误"invalid EAP settings",还有这个错误是什么意思?
首先,我们必须将 .mobileconfig 文件中的证书保存到 $TeamID.com.apple.networkextensionsharing 组中的 iPhone 钥匙串中,同时在 xCode 功能中启用钥匙串访问组并添加$TeamID.com.apple.networkextensionsharing 到 entitlements.After 成功将证书保存到钥匙串中它可以工作。
我在 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()
}
}
问题是:发生了什么事?为什么提示我错误"invalid EAP settings",还有这个错误是什么意思?
首先,我们必须将 .mobileconfig 文件中的证书保存到 $TeamID.com.apple.networkextensionsharing 组中的 iPhone 钥匙串中,同时在 xCode 功能中启用钥匙串访问组并添加$TeamID.com.apple.networkextensionsharing 到 entitlements.After 成功将证书保存到钥匙串中它可以工作。