Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>In order for you to get those notifications you need to be holding on to an instance of CWInterface. Your .h would look like this</p> <pre><code>#import &lt;Cocoa/Cocoa.h&gt; @class CWInterface; @interface AppDelegate : NSObject &lt;NSApplicationDelegate&gt; @property (assign) IBOutlet NSWindow *window; @property (retain) CWInterface *wirelessInterface; @end </code></pre> <p>Then in your .m file would look like this</p> <pre><code>#import "AppDelegate.h" #import &lt;CoreWLAN/CoreWLAN.h&gt; @implementation AppDelegate @synthesize window = _window; @synthesize wirelessInterface; - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { // Insert code here to initialize your application [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:CWModeDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:CWSSIDDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:CWBSSIDDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:CWCountryCodeDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:CWLinkDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleNotification:) name:CWPowerDidChangeNotification object:nil]; self.wirelessInterface = [CWInterface interfaceWithName:@"en1"]; } -(void) handleNotification:(NSNotification*) notification { NSLog(@"Notification Received"); } @end </code></pre> <p>Notice the CWInterface property, that's the important bit</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload