开发者

Toggle Airport Cocoa

开发者 https://www.devze.com 2023-02-11 12:36 出处:网络
Is there any way of toggling开发者_开发知识库 Airport using Cocoa?Use the CoreWLAN framework. To disable the interface,

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

精彩评论

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