iOS获取当前连接wifi名

来源:互联网 发布:淘宝店铺一心是什么 编辑:程序博客网 时间:2024/05/21 10:38
#import <SystemConfiguration/CaptiveNetwork.h>#import <CoreFoundation/CoreFoundation.h>- (NSString *)getCurrentWifiName{    NSString *wifiName = @"Not Found";    CFArrayRef myArray = CNCopySupportedInterfaces();    if (myArray != nil) {        CFDictionaryRef myDict = CNCopyCurrentNetworkInfo(CFArrayGetValueAtIndex(myArray, 0));        if (myDict != nil) {            NSDictionary *dict = (NSDictionary*)CFBridgingRelease(myDict);            wifiName = [dict valueForKey:@"SSID"];        }    }    NSLog(@"wifiName:%@", wifiName);    return wifiName;}


0 0
原创粉丝点击