Hello,
iOS does not have a general-purpose API for Wi-Fi scanning and configuration. However, it does support a wide range of special-purpose Wi-Fi APIs. Please see TN3111: iOS Wi-Fi API overview | Apple Developer Documentation
So, you can try NEHotspotHelper
API and the following code:
using NetworkExtension;
[assembly:Dependency(typeof(GetWifiListService))]
namespace WifiListXamarinSample.iOS
{
public class GetWifiListService :IGetWifiListService
{
public GetWifiListService()
{
}
public void GetWifiList()
{
var queue = new DispatchQueue("com.XXX.HotspotHelper");
NEHotspotHelper.Register(null, queue, (cmd) =>
{
if (cmd.CommandType == NEHotspotHelperCommandType.FilterScanList)
{
foreach (NEHotspotNetwork network in cmd.NetworkList)
{
Console.WriteLine(@"network.SSID = %@", network.Ssid);//you can try to return the network
}
}
});
}
}
}
But I have to say, as noted at Appl's Doc, NEHotspotHelper is only useful for hotspot integration. Before using NEHotspotHelper
, you must first be granted a special entitlement (com.apple.developer.networking.HotspotHelper
) and send Hotspot Helper Request to Apple.
Best Regards,
Wenyan Zhang
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment". Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.