NEHotspotConfigurationErrorDomain 10 cannot modify system configuration.

We have an app that connects to "controllers" over WiFi using this function:

Code Block func joinControllerWiFi(ssid:String, completion: @escaping (_ isConnected: Bool) -> Void) {
        let configuration = NEHotspotConfiguration.init(ssid: ssid, passphrase: "passphrase", isWEP: false)
        configuration.joinOnce = true
        NEHotspotConfigurationManager.shared.apply(configuration) { (error) in
                    if let error = error as NSError? {
                        print("WiFi Connection Error: \(error.domain) \(error.code) \(configuration.ssid) \(error.localizedDescription)")
                        completion(false)
                    } else if error != nil {
                        print("WiFi Connection Error: \(error!.localizedDescription)")
                        completion(false)
                    } else {
                        print("WiFi Connected")
                        completion(true)
                    }
        }
    }

Everything works perfectly except when we apply our profile to the device and then we get the "NEHotspotConfigurationErrorDomain 10 cannot modify system configuration" error.

Location authentication is set to authorizedWhenInUse.

I'm assuming this is an issue with the profile or we're missing a permission somewhere. Can anyone point us in the right direction?

Thank you in advance.
Regarding:

Everything works perfectly except when we apply our profile to the device and then we get the "NEHotspotConfigurationErrorDomain 10 cannot modify system configuration" error.

Yeah, NEHotspotConfigurationErrorDomain 10 as the name implies is a system configuration error. When you mention profile, did you mean the network configuration that NEHotspotConfiguration is installing or did you mean the usage of NEHotspotConfiguration and an actual configuration profile at the same time?


Matt Eaton
DTS Engineering, CoreOS
meaton3@apple.com
Sorry for the confusion. When I said profile, I meant an actual configuration profile that we're installing on device to limit the networks the iPad/iPhone can connect to. We are trying to use NEHotspotConfiguration to manage the network ("controller") that the device is connecting to out of the list of possible networks ("controllers") established in the configuration profile.

Example: The iPad should be able to connect to any of the three Controllers via NEHotspotConfiguration:

iPad/iPhone Configuration Profile

Controller1 (SSID, password)
NEHotspotConfiguration => Controller2 (SSID, password)
Controller3 (SSID, password)

I hope this makes sense. Please let me know.

Thank you.


NEHotspotConfigurationErrorDomain 10 cannot modify system configuration.
 
 
Q