码迷,mamicode.com
首页 > 移动开发 > 详细

iOS获取当前路由信息

时间:2015-03-04 18:57:17      阅读:143      评论:0      收藏:0      [点我收藏+]

标签:

导入头文件:

#import <SystemConfiguration/CaptiveNetwork.h>

 

- (void)currentWifiSSID {
    // Does not work on the simulator.
    NSArray *ifs = (__bridge id)CNCopySupportedInterfaces();
    NSLog(@"ifs:%@",ifs);
    for (NSString *ifnam in ifs) {
        NSDictionary *info = (__bridge id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);
        NSLog(@"dici:%@",[info allKeys]);
        if (info[@"BSSID"]) {
            ramcstr = info[@"BSSID"];
            NSLog(@"%@",ramcstr);
        }
        if (info[@"SSID"]) {
            rssidstr = info[@"SSID"];
            NSLog(@"%@",rssidstr);
        }

        if (info[@"SSIDDATA"]){

           SSIDDATAstr = info[@"SSIDDATA"];

           NSLog(@"%@",SSIDDATAstr);

        }


    }
}

iOS获取当前路由信息

标签:

原文地址:http://www.cnblogs.com/z-j-w/p/4313981.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!