Auto connect to SSID(WiFi profiled EAP-SIM)

I created and installed wifi profile for EAP SIM. I can connect to respective SSID by manual selection in wifi settings.But I am trying to auto connect to that SSID from my code.I don't want to change any configuration as it is in wifi profile, just want to connect. How far I have tried :


let hotspotEAPSettings = NEHotspotEAPSettings.init() 
hotspotEAPSettings.supportedEAPTypes = [18] 
let hotspotConfig = NEHotspotConfiguration(ssid: "WiFiCalling", eapSettings: hotspotEAPSettings) 
NEHotspotConfigurationManager.shared.apply(hotspotConfig) {[unowned self] (error) in 
        if error != nil { 
              if error?.localizedDescription == "already associated." 
               { 
                       print("Connected") 
                } 
                 else{ 
                       print("No Connected") 
                  } 
        } 
        else { 
               print("Connected") 
         } 
}


Error Domain=NEHotspotConfigurationErrorDomain Code=4 "invalid EAP settings." UserInfo={NSLocalizedDescription=invalid EAP settingsIf I execute this code

For manula connection, wifiCalling doesn't required any password. When I execute this block ,

let hotspotConfig = NEHotspotConfiguration(ssid: "WiFiCalling") 
NEHotspotConfigurationManager.shared.apply(hotspotConfig) {[unowned self] (error) in 
        if error != nil { 
              if error?.localizedDescription == "already associated." 
               { 
                       print("Connected") 
                } 
                 else{ 
                       print("No Connected") 
                  } 
        } 
        else { 
               print("Connected") 
         } 
}

It is saying :


Error Domain=NEHotspotConfigurationErrorDomain Code=10 "cannot modify system configuration." UserInfo={NSLocalizedDescription=cannot modify system configuration.


I have searched a lot, spent days on it. But got no proper suggestion for EAP SIM.Thanks to advance.

NOTES: I can auto connect to other wifi except EAP WiFi

Replies

Do you already have a configuration for this

WiFiCalling
SSID? Perhaps created via Settings > Wi-Fi? Or installed via a configuration profile?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"