6

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


Dhaval Kansara
  • 3,478
  • 5
  • 22
  • 50
Kim sunny
  • 63
  • 1
  • 5
  • Possible duplicate of [NEHotspotHelper.register not received call back iOS11](https://stackoverflow.com/questions/46767138/nehotspothelper-register-not-received-call-back-ios11) – Senseful Sep 24 '18 at 06:07
  • What is the value of these queues and options? In your case, you have given ```[[NSMutableDictionary alloc] init]; [options setObject:@"Try Here" forKey:kNEHotspotHelperOptionDisplayName]; dispatch_queue_t queue = dispatch_queue_create("com.miro.wifilist", 0);``` – Dhaval Kansara Feb 11 '20 at 09:05

2 Answers2

2

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

Leon
  • 3,614
  • 1
  • 33
  • 46
1
  1. You need to complete a questionnaire at https://developer.apple.com/contact/network-extension, and then you can use NEHotspotHelper to return a list of hotspots.
  2. Apple sends this message: enter image description here
  3. In your provisioning profile settings in Apple Developer page take an expanded view (Add "com.apple.developer.HotspotHelper" with boolean type and "true"), how this enter image description here
Bug
  • 2,576
  • 2
  • 21
  • 36
  • I already answered questionnaire. Then, I got message like this from apple. _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._ But the date in your image is 9/14/2015. Is it still valid?? – Kim sunny Oct 25 '17 at 02:11
  • 1
    If you already wrote to Apple, then try to add the following in your application. 1. Add com.apple.developer.networking.HotspotHelper with key YES in the Entitlement file, how this [link](http://joxi.ru/RmzXYqf0zB0GAO.jpg) 2. The application's Info.plist must include a UIBackgroundModes array containing 'network-authentication', how this [link](http://joxi.ru/E2pvedh9qg76rY.jpg) After that everything should work or when you run will give the error "The executable was signed with invalid entitlements." - so Apple has not allowed access. – Vkrotin Lexys Oct 25 '17 at 08:24
  • All your tips already tried. But I got error _The executable was signed with invalid entitlements_. As you told, I think apple did not allow me using this API. Thanks for your help – Kim sunny Oct 25 '17 at 08:56
  • While **Apply for the Network Extension entitlement.** we have to answer two questions which are - **Which IP protocol does your app support?** and **Which transport protocol does your app support?** - How I can find the answer to this question in my project? Any Idea? – Dhaval Kansara Feb 11 '20 at 10:37
  • @VkrotinLexys I already answered the questionnaire for NHHotspotHelper but didn't receive any acknowledge from their side. Also performed all the step as you mentioned in the above comments but still while trying to build project in getting error. ```Automatic signing is unable to resolve an issue with the "Runner" target's entitlements. Automatic signing can't add the com.apple.developer.networking.HotspotHelper entitlement to your provisioning profile.``` – Dhaval Kansara Feb 24 '20 at 12:49