iOS获取WiFi信息

1.导入头文件

#import <SystemConfiguration/CaptiveNetwork.h>

2.方法

- (NSDictionary *)getWIFIDict{
    
    CFArrayRef myArray = CNCopySupportedInterfaces();
    if (myArray != nil) {
        CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
        if (myDict != nil) {
            NSDictionary *dic = (NSDictionary*)CFBridgingRelease(myDict);
            return dic;
        }
    }
    return nil;
}

3.获取结果

2016-05-26 18:35:02.598 WIFI[4074:1984356] dict == {
    BSSID = "bc:54:36:ce:b2:c4";
    SSID = ZFJWifi;
    SSIDDATA = <5a464a57 696669>;
}

DEMO下载地址:http://download.csdn.net/detail/u014220518/9643016

特别声明:文章多为网络转载,资源使用一般不提供任何帮助,特殊资源除外,如有侵权请联系!
技术狗 » iOS获取WiFi信息