如何使用NEHotspotHelper(IOS,objective-c)获得可用的WiFi列表 [英] How can I get available WiFi list with NEHotspotHelper (IOS, objective-c)

查看:1240
本文介绍了如何使用NEHotspotHelper(IOS,objective-c)获得可用的WiFi列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经做到了.

1.在Apple Developer页面中添加IOS证书.

2.在Apple Developer页面中添加启用了Network Extension的标识符应用程序ID.

3.在Apple Developer页面中添加配置文件.

4.创建Xcode项目,然后键入在Apple开发人员页面上创建的正确的捆绑包ID.并签署合适的团队.

5.添加功能和库(网络扩展框架).

6. 5之后,将在我的Xcode项目中自动生成权利文件.

7.最后,我编写了这样的代码.

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 @"";

但是我无法获得任何wifi列表.在我的源代码中,变量"isAvailable"返回false.

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

为解决此问题,我另外尝试了此操作.

添加具有布尔类型和"true"的" com.apple.developer.networking.HotspotHelper "

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.

我是否想使用网络扩展库或NEHotspotHelper进行身份验证? 还是我的来源有任何错误?

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

** 在我向Apple请求网络扩展库后,我从Apple收到了这样的消息.

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

来自苹果的消息内容

感谢您请求有关网络扩展框架的信息.请注意,自2016年11月10日起,希望使用应用程序代理,内容过滤器或数据包隧道API的开发人员无需执行此过程.要使用这些服务,请在 https://developer.apple.com/account/上浏览到您的开发者帐户. a>,然后为您要用于应用程序的应用程序ID选择网络扩展功能.

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.

如果您要求获得Hotspot Helper API的权利,我们会尽快为您解决该请求.

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

关于

开发者技术支持

Apple全球开发人员关系

Apple Worldwide Developer Relations

推荐答案

  1. 您需要在 https://developer.apple.com/contact/上填写调查表.网络扩展,然后您可以使用NEHotspotHelper返回热点列表.
  2. Apple发送此消息:
  3. 在Apple Developer页面的置备配置文件设置中,展开视图(添加带有布尔类型和"true"的"com.apple.developer.HotspotHelper"),如何
  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

这篇关于如何使用NEHotspotHelper(IOS,objective-c)获得可用的WiFi列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆