博客> 获取当前连接的wifi名称获取当前连接的wifi名称//模拟器下会失败
获取当前连接的wifi名称获取当前连接的wifi名称//模拟器下会失败
2019-12-10 17:06 评论:0 阅读:622 gedefu

import

    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);
收藏
0
sina weixin mail 回到顶部