Reputation: 421
I have been using NetworkExtension and I am having some doubts, and need help. In my entitlements is set:
<key>com.apple.developer.networking.HotspotHelper</key>
<true/>
<key>com.apple.external-accessory.wireless-configuration</key>
<true/>
I set in the Info.plist:
<key>UIBackgroundModes</key>
<array>
<string>network-authentication</string>
</array>
In my controller I coded:
NSArray * networkInterfaces = [NEHotspotHelper supportedNetworkInterfaces];
NSLog(@"Networks %@",networkInterfaces);
But the return is nil.
I also tried register NEHotspotHelp, and after I have used [NEHotspotHelper supportedNetworkInterfaces] but return only the network connected.
NSMutableDictionary* options = [[NSMutableDictionary alloc] init];
[options setObject:@"Hotspot" forKey:kNEHotspotHelperOptionDisplayName];
dispatch_queue_t queue = dispatch_queue_create("com.myapp.wifi", 0);
BOOL returnType = [NEHotspotHelper registerWithOptions:options queue:queue handler: ^(NEHotspotHelperCommand * cmd) {
}];
NSArray * networkInterfaces = [NEHotspotHelper supportedNetworkInterfaces];
NSLog(@"Networks %@",networkInterfaces);
Is possible list nearby networks in my application, without enter in the screen of Settings/Wifi?
When use [NEHotspotHelper supportedNetworkInterfaces] may I list all nearby networks?
Thanks a lot.
Michel de Sousa
Upvotes: 0
Views: 865
Reputation: 421
I resolved my problem, but is need enter in the screen of Settings/Wi-fi.
I listed nearby network in my application using:
NSMutableDictionary* options = [[NSMutableDictionary alloc] init];
[options setObject:@"Connect using my app" forKey:kNEHotspotHelperOptionDisplayName];
dispatch_queue_t queue = dispatch_queue_create("com.myapp.wifi", 0);
[NEHotspotHelper registerWithOptions:optionsqueue:queue handler: ^(NEHotspotHelperCommand * cmd) {
if(cmd.commandType == kNEHotspotHelperCommandTypeFilterScanList){
for (NEHotspotNetwork *eachNetwork in cmd.networkList) {
// Get Informations of the network
NSLog(@"%@", eachNetwork.SSID);
}
}
}];
Upvotes: 2