Hi,It works in my project. The error means a internal error, you could restart your device to check whether it works.
NEHotspotConfigurationErrorInternal = 8
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello everyone,
I tried to make my iPhone change the Wifi network using this code in Xamarin.iOS:
public class ConnectToWifi : IConnectToWifi
{
public string SSID;
public string Password;
public IPAddress ServerAddress;
int ServerPort = -1;
public bool isConnect = true;
public CFSocket Socket;
public CFSocket ServerSocket;
NEHotspotConfigurationManager wifiManager;
public ConnectToWifi()
{
wifiManager = new NEHotspotConfigurationManager();
}
public async Task<bool> Connect(string Ip, int Port)
{
isConnect = false;
ServerPort = Port;
try
{
ServerAddress = new IPAddress(IPAddress.Parse(Ip).GetAddressBytes());
Socket = new CFSocket();
NEHotspotConfigurationManager.SharedManager.GetConfiguredSsids((listWifi) =>
{
if (listWifi != null)
{
foreach (string ssid_selected in listWifi)
{
if (ssid_selected == SSID)
{
NEHotspotConfigurationManager.SharedManager.RemoveConfiguration(SSID);
}
}
}
});
NEHotspotConfiguration wifiNetwork = new NEHotspotConfiguration(SSID, Password, false);
wifiNetwork.JoinOnce = true;
wifiManager.ApplyConfiguration(wifiNetwork, (error) =>
{
if (error != null)
{
System.Diagnostics.Debug.Write(error.Description);
}
else
{
System.Diagnostics.Debug.Write("Connected");
}
isConnect = true;
});
}
catch (CFSocketException exception)
{
System.Diagnostics.Debug.WriteLine("Ho ricevuto questo errore nella Connect: " + exception.Message);
return isConnect;
}
catch (Exception ex)
{
System.Diagnostics.Debug.WriteLine("Ho ricevuto questo errore nella Connect: " + ex.Message);
return isConnect;
}
return isConnect;
}
Upon connection comes the wifiManager function.ApplyConfiguration returns the following error:
Error Domain=NEHotspotConfigurationErrorDomain Code=8 "internal error." UserInfo={NSLocalizedDescription=internal error.}
I have an iPhone X with iOS 14.6 and a MacBook with:
In my AppID profile and in the Entitlements.plist file I have activated the following services:
Thank you very much for helping!
Regards,
Giacomo Ferrera
Hi,It works in my project. The error means a internal error, you could restart your device to check whether it works.
NEHotspotConfigurationErrorInternal = 8