I am trying to get my mobile app to connect to a Wifi network (for configuration purposes). This should be possible as of iOS 11 through the NEHotspotConfiguration
& NEHotspotConfigurationManager
classes.
The problem is that I keep getting an Internal Error (error code 8) and I don’t get a user prompt to ask for permission to connect to wifi network. I have already set the Hotspot Configuration capability in Xcode that the NEHotspotConfigurationManager class requires. Also worth mentioning that I am testing this on a real device only, since the iOS simulator does not support wifi.
Although I am using the NativeScript framework, it seems that this is more of an issue with the underlying iOS platform.
So far I have this code:
this.wifiManager = NEHotspotConfigurationManager.new();
this.wifiConfig = NEHotspotConfiguration.alloc().initWithSSID(this.config.wifi.SSID);
this.wifiConfig.joinOnce = true;
this.wifiManager.applyConfigurationCompletionHandler(this.wifiConfig, (error: NSError) => {
if (error && error.code!==NEHotspotConfigurationError.AlreadyAssociated) {
console.log(`wifiManager.applyConfigurationCompletionHandler error code ${error.code}: ${error.localizedDescription}`);
} else {
console.log(`wifiManager.applyConfigurationCompletionHandler success!`);
}
});
Thanks in advance!
P.S. this post suggest that it might just be an issue on the device itself and that a device restart should solve the issue but that is not the case for me