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

让人想犯罪 __ 提交于 2019-12-05 02:09:13

问题


I have already done this.

1. Add IOS certifivate 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 xcode project and type the correct bundle ID which made in 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 in my device. I get error message like this "The excutable was signed with invaild entitlements".

I don't know why is not working.

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

** After I requested Network Extension library to apple, I got 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



回答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:
  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


来源:https://stackoverflow.com/questions/46823754/how-can-i-get-available-wifi-list-with-nehotspothelper-ios-objective-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!