zoukankan      html  css  js  c++  java
  • 获取wifi信息

    最近有个项目需要获取手机附近wifi列表,查了许多资料发现,现在只能查到wifi的SSID,并且用到的是私有api,无法通过app store审核,这里记录一下,方便学习,新手勿喷,欢迎大神指教(wifi信息获取需要真机测试才能获取数据)

    导入系统头文件

    #import <SystemConfiguration/CaptiveNetwork.h>

    实现代码

    NSString *ssid = @"Not Found";
    NSString *macIp = @"Not Found";
    CFArrayRef myArray = CNCopySupportedInterfaces();
    if (myArray != nil) {
    CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));
    if (myDict != nil) {
    NSDictionary *dict = (NSDictionary*)CFBridgingRelease(myDict);

    ssid = [dict valueForKey:@"SSID"];
    macIp = [dict valueForKey:@"BSSID"];
    }
    }
    UIAlertView *av = [[UIAlertView alloc] initWithTitle:ssid
    message:macIp
    delegate:nil
    cancelButtonTitle:nil
    otherButtonTitles:@"OK", nil];
    [av show];

     

    工作小记,欢迎共享
  • 相关阅读:
    12.12
    12.11
    1208
    1206
    2018-12-23丛晓强作业
    2018-12-17面向对象总结
    2018-12-17-丛晓强作业
    2018-12-13丛晓强作业
    2018-12-12丛晓强作业
    2018-12-11丛晓强作业
  • 原文地址:https://www.cnblogs.com/fannyLi/p/4166641.html
Copyright © 2011-2022 走看看