Thank you for details and explanation.
[quote='806989022, DTS Engineer, /thread/765186?answerId=806989022#806989022']
What sort of network requires you to set these parameters?
[/quote]
Actually it is a private network and to connect with this private network i need to setup all IP Address, SubNetMask, Router and DNS server address.
[quote='806989022, DTS Engineer, /thread/765186?answerId=806989022#806989022']
You can monitor the current networking state to see if the join request was successful.
[/quote]
Like you suggested i already tried with monitoring the current connected Wifi SSID using the below code. So then i can figure the connected and not connected status correctly.
let eapSetting = NEHotspotEAPSettings()
eapSetting.username = self.username
eapSetting.password = self.password
eapSetting.supportedEAPTypes = [NEHotspotEAPSettings.EAPType.EAPPEAP.rawValue as NSNumber]
eapSetting.trustedServerNames = ["ABC"]
NEHotspotConfigurationManager.shared.removeConfiguration(forSSID: self.ssid)
let hotspotConfiguration = NEHotspotConfiguration(ssid: self.ssid, eapSettings: eapSetting)
manager.apply(hotspotConfiguration){ (error) in
if self.currentSSIDs().first == self.ssid {
print("Success")
return
} else {
print("Error")
return
}
}
func currentSSIDs() -> [String] {
guard let interfaceNames = CNCopySupportedInterfaces() as? [String] else {
return []
}
return interfaceNames.flatMap { name in
guard let info = CNCopyCurrentNetworkInfo(name as! CFString) as? [String:AnyObject] else {
return nil
}
guard let ssid = info[kCNNetworkInfoKeySSID as String] as? String else {
return nil
}
return ssid
}
}
I only need to test it for three cases,
Wrong SSID
Wrong UserName
Wrong Password
when i test for above test cases output from currentSSIDs() method is like below,
Wrong SSID → []
Wrong UserName → []
Wrong Password → ["SSID1"]
if currentSSIDs() method's output is like [] for above three case i was able to handle my error part without problem. But for Wrong Password it is return as connected. So i would like to know whether my code is wrong or is there a another way to catch these three cases?