哥来自火星
哥来自火星
  • 发布:2016-08-02 10:45
  • 更新:2019-10-14 17:32
  • 阅读:2713

iOS 获取WiFi网络的BSSID代码的NJS写法

分类:Native.js

//导入框架头文件

import <SystemConfiguration/CaptiveNetwork.h>

@interface ViewController ()
//定义一个label用于显示当前所连WiFi名称
@property (weak, nonatomic) IBOutlet UILabel l1;
@property (weak, nonatomic) IBOutlet UILabel
l2;

@end

@implementation ViewController

  • (void)viewDidLoad {
    [super viewDidLoad];
    id info = nil;
    NSArray ifs = (__bridge_transfer id)CNCopySupportedInterfaces();
    for (NSString
    ifnam in ifs) {
    info = (__bridge_transfer id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
    NSString str = info[@"SSID"];
    NSString
    str2 = info[@"BSSID"];
    NSString *str3 = [[ NSString alloc] initWithData:info[@"SSIDDATA"] encoding:NSUTF8StringEncoding];
    _l1.text = str;
    _l2.text = str2;

    }
    }

@end
需要将这段代码转换成NJS,请各位帮帮忙!

2016-08-02 10:45 负责人:无 分享
已邀请:
DCloud_IOS_XTY

DCloud_IOS_XTY

目前暂不支持C函数调用

8***@qq.com

8***@qq.com - phper

哥们解决了么?

惊鸿1997

惊鸿1997

iOS用原生写的wifi切换插件,在HbuilderX里报错了,是要设置什么权限么?

该问题目前已经被锁定, 无法添加新回复