开发者

Toggle Airport Cocoa

Is there any way of toggling开发者_开发知识库 Airport using 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:.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜