corewlan

using startMonitoringEventWithType: error: in the effort to detect wifi SSID change

最后都变了- 提交于 2019-12-08 15:26:57
问题 Apple seems to introduce quite a change with Yosemite and CoreWLAN framework. I would like to use its new API, quoting the header file: /*! * @method * * @param type * A CWEventType value. * * @param error * An NSError object passed by reference, which upon return will contain the error if an error occurs. * This parameter is optional. * * @result * A BOOL value indicating whether or not an error occurred. YES indicates no error occurred. * * @abstract * Register for specific Wi-Fi event

CWInterface returning no data

北慕城南 提交于 2019-12-04 06:16:23
问题 I try to collect some information about the current state of the CWInterface(connected bssid, available access points...) and send them periodic (every 5-10 sec) via udp to a server. My Problem is that after some time (between 30 and 50 min in some tests with different collection/sending interval) the CWInterface stops returning data. [CWInterface interface] returns nil [CWInterface interfaceNames] returns a NSSet with 0 entries [[CWInterface interface] scanForNetworksWithSSID:nil &error]

CWInterface returning no data

南笙酒味 提交于 2019-12-02 08:14:25
I try to collect some information about the current state of the CWInterface(connected bssid, available access points...) and send them periodic (every 5-10 sec) via udp to a server. My Problem is that after some time (between 30 and 50 min in some tests with different collection/sending interval) the CWInterface stops returning data. [CWInterface interface] returns nil [CWInterface interfaceNames] returns a NSSet with 0 entries [[CWInterface interface] scanForNetworksWithSSID:nil &error] also returns a NSSet with 0 entries What am I doing wrong? I'm totaly out of ideas... OK as I already

Display all available WIFI connections with Swift in OS X

∥☆過路亽.° 提交于 2019-11-30 16:43:38
I'm trying to display all available WIFI connections. It doesn't work. Here is my code: import Foundation import CoreWLAN var cwInterface = CWInterface() do { let routers = try cwInterface.scanForNetworksWithSSID(nil) print(routers) } catch let error as NSError { print("Error: \(error.localizedDescription)") } I don't get any result. What I'm doing wrong? It works if you initialize CWInterface with an interface name, like "en1". But it's better to not use harcoded names, so we'll also use CWWiFiClient.sharedWiFiClient().interface() which returns the default WIFI interface. Example of a class

Display all available WIFI connections with Swift in OS X

别说谁变了你拦得住时间么 提交于 2019-11-29 23:30:09
问题 I'm trying to display all available WIFI connections. It doesn't work. Here is my code: import Foundation import CoreWLAN var cwInterface = CWInterface() do { let routers = try cwInterface.scanForNetworksWithSSID(nil) print(routers) } catch let error as NSError { print("Error: \(error.localizedDescription)") } I don't get any result. What I'm doing wrong? 回答1: It works if you initialize CWInterface with an interface name, like "en1". But it's better to not use harcoded names, so we'll also