在OS X上获取活动网络连接

时间:2016-09-01 09:27:30

标签: objective-c swift macos cocoa

有没有办法在不使用shell脚本的情况下检索活动/非活动网络连接? CWInterface仅提供有关WiFi网络的信息,而OS X上不提供CNCopyCurrentNetworkInfo。

1 个答案:

答案 0 :(得分:1)

        CWInterface* wifi = [[CWWiFiClient sharedWiFiClient] interface];
        int secType     = (int)[wifi security];
        int channel     = (int) [[wifi wlanChannel] channelNumber];
        int rssi        = [wifi rssiValue];
        NSString *ssid  = [wifi ssid];
        NSString *bssid = [wifi bssid];