iosobjective-ccertificatexcode8nehotspothelper

How can I get available WiFi list with NEHotspotHelper (IOS, objective-c)


I have already done this.

1. Add IOS certificate in Apple Developer page.

2. Add identifiers App IDs with Network Extension enabled in Apple Developer page.

3. Add provisioning profile in Apple Developer page.

4. Create the Xcode project and type the correct bundle ID which made on the apple developer page. And sign right team.

5. Add capabilities and library (Network Extension framework).

6. After 5, Entitlement file is generated automatically in my Xcode project.

7. At last time I wrote the code like this.

NSLog(@"List Scan START");

NSMutableDictionary* options = [[NSMutableDictionary alloc] init];
    [options setObject:@"Try Here" forKey:kNEHotspotHelperOptionDisplayName];
    dispatch_queue_t queue = dispatch_queue_create("com.miro.wifilist", 0);

    BOOL isAvailable = [NEHotspotHelper registerWithOptions:options queue:queue handler: ^(NEHotspotHelperCommand * cmd) {
        if (cmd.commandType == kNEHotspotHelperCommandTypeEvaluate || cmd.commandType == kNEHotspotHelperCommandTypeFilterScanList ) {
            for (NEHotspotNetwork* network in cmd.networkList) {
                NSLog(@"%@", network.SSID);
            }
        } else {
            NSLog(@"there is no available wifi");
        }
    }];

if (isAvailable) {
    NSLog(@"true");
} else {
    NSLog(@"false");
}

NSLog(@"List scan END");
return @"";

But I can't get any wifi list. In my source, variable "isAvailable" is returned false.

To resolve this problem I tried this additionally.

Add "com.apple.developer.networking.HotspotHelper" with boolean type and "true"

-> result of this: I can build the project, but I can't install the app on my device. I get an error message like this "The executable was signed with invalid entitlements".

I don't know why is not working.

Do I miss something to authenticate to use the Network Extension library or NEHotspotHelper?? Or is there any error in my source??

** After I requested the Network Extension library to apple, I got the message like this from apple.

message content from apple


Thank you for requesting information about the Network Extension framework. Please note that as of November 10, 2016, this process is not required for developers who wish to use App Proxy, Content Filter, or Packet Tunnel APIs. To use these services please navigate to your Developer Account at https://developer.apple.com/account/ and select the Network Extension capability for the App ID you will be using for your app.

If you are requesting an entitlement for Hotspot Helper APIs your request will be addressed at our earliest convenience.

Regards,

Developer Technical Support

Apple Worldwide Developer Relations



Solution

  • It's worth highlighting that it's not actually possible to get a list of available Wifi hotspots on an iOS device. Please have a read of this post:

    Apple Developer Forums: List available wifi network