Code Monkey home page Code Monkey logo

wifiinfodemo's Introduction

WiFiInfoDemo

WiFiInfoDemo

做项目过程中,因项目需求需要获取WiFi的信息,当时也是在网络上收集一些方法归纳在一起

####(里面部分方法可能会影响APP上线,请需要上线的同学 查证后使用) ###API 都是类方法 方便调用

//获取WiFi 信息,返回的字典中包含了WiFi的名称、路由器的Mac地址、还有一个Data(转换成字符串打印出来是wifi名称)
+ (NSDictionary *)fetchSSIDInfo;

//获取WiFi的名称
+ (NSString *)fetchWiFiName;

/** 获取网关 */
+ (NSString *)getGatewayIpForCurrentWiFi;

/** 获取本机在WiFi环境下的IP地址 */
+ (NSString *)getLocalIPAddressForCurrentWiFi;

/** 广播地址、子网掩码、端口等,组装成一个字典。 */
+ (NSMutableDictionary *)getLocalInfoForCurrentWiFi;

###使用方法

//获取WiFi 信息,返回的字典中包含了WiFi的名称、路由器的Mac地址、还有一个Data(转换成字符串打印出来是wifi名称)
NSDictionary *infoDict = [WiFiInfoTool fetchSSIDInfo];
NSLog(@"->%@", infoDict);
//获取WiFi的名称
NSString *nameStr = [WiFiInfoTool fetchWiFiName];
NSLog(@"->%@", nameStr);
//获取网关
NSString *ipStr = [WiFiInfoTool getGatewayIpForCurrentWiFi];
NSLog(@"->%@", ipStr);
// 获取本机在WiFi环境下的IP地址
NSString *wifiAdd = [WiFiInfoTool getLocalIPAddressForCurrentWiFi];
NSLog(@"->%@", wifiAdd);
//广播地址、子网掩码、端口等,组装成一个字典
NSDictionary *wifiInfoDict = [WiFiInfoTool getLocalInfoForCurrentWiFi];
NSLog(@"->%@", wifiInfoDict);

wifiinfodemo's People

Contributors

ywdonga avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.