Toggle Airport Cocoa

Solutions Collect From Internet About “Toggle Airport Cocoa”

Use the CoreWLAN framework. To disable the interface,

#import <CoreWLAN/CoreWLAN.h>

NSError *error = nil;
CWInterface *wif = [CWInterface interface];
BOOL setPowerSuccess = [wif setPower:NO error:&error];
if (! setPowerSuccess) {
    NSLog(@"error whilst disabling airport: %@", error);
}

To enable the interface, pass YES to -setPower:error:.