How to connect to a private Wifi network

hi !

I am developing an application in Xamarin.Forms. A nd I need to add a feature to one of my apps.

I know the SSID and PWD of a network and I would like from my app to have a button that allows me to connect to it.

i read the TN3111: iOS Wi-Fi API overview | Apple Developer Documentation & Wi-Fi Configuration | Apple Developer Documentation

This is my code , but i only get Internal Error : Code 8.

var wifiManager = new NEHotspotConfigurationManager();
var wifiConfig = new NEHotspotConfiguration(ssid, pws, false);
wifiConfig.JoinOnce = true;
wifiManager.ApplyConfiguration(wifiConfig, (error) =>
     {
          if (error != null)
             {
             App.Current.MainPage.DisplayAlert($"Error while connecting to WiFi network {ssid}", $"{error}", "ok");
              }
      });

Do i need any special entitlement for using this wifi API ?

Thx for the help

Can you join the Wi-Fi network from Settings?

If you build and run the NEHotspotConfiguration Sample sample code, can you join the network using it?

Do i need any special entitlement for using this wifi API ?

Yes. The docs are pretty clear about that. See the Important box at the top of this page. It is not, however, a managed capability. That is, anyone can enable this without special approval from Apple.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Can you join the Wi-Fi network from Settings?

Yes

Yes. The docs are pretty clear about that. See the Important box at the top of this page. It is not, however, a managed capability. That is, anyone can enable this without special approval from Apple.

Well , lets go for asking it

Oh my previous message was wrong. ( misunderstood entitlements & capabilities :) )

is this the right capability ?

checking this quote , using the right provisioning profile , and the connection should works ?

Is this allow too in debugging mode ? or just for released app ?

is this the right capability ?

Yes.

In Xcode this is called Hotspot Configuration, which is much clearer because it matches the documentation. I’d appreciate you filing a bug against the Developer website requesting that it use the same terminology. Please post your bug number, just for the record.

Is this allow too in debugging mode ? or just for released app ?

There are no distribution restrictions.

ps You can see this for yourself by following the steps in Finding a Capability’s Distribution Restrictions.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

How to connect to a private Wifi network
 
 
Q