//导入框架头文件
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,请各位帮帮忙!
哥来自火星 (作者)
swift 呢
2016-08-03 17:26
DCloud_IOS_XTY
支持
2016-08-03 17:43
哥来自火星 (作者)
是否可以采用插件的方式来解决呢
2016-08-08 18:00
DCloud_IOS_XTY
可以
2016-08-11 11:42