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];

     

    工作小记,欢迎共享
  • 相关阅读:
    R语言中的logical(0)和numeric(0)以及赋值问题
    创建hadoop用户
    虚拟机安装
    spark1-MapReduce
    arcgis1-shp转成mdb
    Actor-配置Maven
    scala6-单词计数(map(),flatMap())
    scala5-数组
    scala4-函数
    scala3-for循环
  • 原文地址:https://www.cnblogs.com/fannyLi/p/4166641.html
Copyright © 2011-2022 走看看