Hi,
I create application "Connecting to WiFi in iOS"
Code to connecting:
Swift
let configuration = NEHotspotConfiguration.init(ssid: "SSIDname", passphrase: "Password", isWEP: false)
configuration.joinOnce = true
NEHotspotConfigurationManager.shared.apply(configuration) { (error) in
if error != nil {
if error?.localizedDescription == "already associated."
{
print("Connected")
}
else{
print("No Connected")
}
}
else {
print("Connected")
}
}
and Xamarin
[assembly: Dependency(typeof(WifiConnector))]
namespace WiFiManager.iOS
{
public class WifiConnector : IWifiConnector
{
public void ConnectToWifi(string ssid, string password)
{
var wifiManager = new NEHotspotConfigurationManager();
var wifiConfig = new NEHotspotConfiguration(ssid, password, false);
wifiManager.ApplyConfiguration(wifiConfig, (error) =>
{
if (error != null)
{
Console.WriteLine($"Error while connecting to WiFi network {ssid}: {error}");
}
});
}
}
}
Everything works fine but iOS always asks a question "Wants to Join Wi-Fi Network".
Is there any possibility that it would not ask? For my application, this popup is a problem. Maybe list of preferred network?
Thank you in advance!