获取wifi的SSID

#import <SystemConfiguration/CaptiveNetwork.h>

 

- (NSString *)currentWifiSSID {

    // Does not work on the simulator.

    NSString *ssid = nil;

    NSArray *ifs = (id)CNCopySupportedInterfaces();

    for (NSString *ifnam in ifs) {

        NSDictionary *info = (id)CNCopyCurrentNetworkInfo((CFStringRef)ifnam);

        if (info[@"SSID"]) {

            ssid = info[@"SSID"];

            

        }

    }

    return ssid;

}

你可能感兴趣的:(ios,SSID,wifi ssid)