WiFiKit.framework

From iPhone Development Wiki
Jump to: navigation, search
WiFiKit.framework
Private Framework
Availabile 11.0 – present
Headers [headers.cynder.me]


WiFiKit is a private framework that provides a high-level ObjC API to MobileWiFi.framework. Its functionality used to be in AirPortSettings.bundle but it has now been factored out to this new framework and AirPortSettings now contains simply one class APNetworksController that uses WFNetworkListController from this framework.

It requires the com.apple.wifi.manager-access entitlement.

#import <WiFiKit/WiFiKit.h>

@interface AppDelegate () <WFScanManagerDelegate>

@property (strong, nonatomic) WFScanManager *scanManager;

@end

@implementation AppDelegate

- (WFScanManager *)scanManager{
    if(!_scanManager){
        WFClient *client = [[WFClientClass alloc] init];
        _scanManager = [[WFScanManager alloc] initWithClient:client scanInterval:6 delegate:self]; // minimum 6
    }
    return _scanManager;
}

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [self.scanManager start];
    return YES;
}

// called first for 2.4GHz then second for 5GHz
-(void)scanManager:(WFScanManager *)scanManager updatedPartialResults:(NSSet<WFNetworkScanRecord *> *)partialResults{
    NSLog(@"%@", NSStringFromSelector(_cmd));
}

// called immediately after 5GHz partial
- (void)scanManagerScanningDidFinish:(WFScanManager *)scanManager withResults:(NSSet<WFNetworkScanRecord *> *)results error:(NSError *)error{
    NSLog(@"%@", NSStringFromSelector(_cmd));
}