iOS 获取当前Wifi的SSID

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

首先添加框架:SystemConfiguration.framework

    #import <SystemConfiguration/CaptiveNetwork.h>  
      
    - (NSString *) getDeviceSSID  
    {  
        NSArray *ifs = (__bridge id)CNCopySupportedInterfaces();  
      
        id info = nil;  
        for (NSString *ifnam in ifs) {  
            info = (__bridge id)CNCopyCurrentNetworkInfo((__bridge CFStringRef)ifnam);  
            if (info && [info count]) {  
                break;  
            }  
        }  
        NSDictionary *dctySSID = (NSDictionary *)info;  
        NSString *ssid = [[dctySSID objectForKey:@"SSID"] lowercaseString];  
      
        return ssid;  
      
    }