We tried out the new NetworkExtension API. We were successful in recreating all the steps in our app. But, we have an issue that we are still not seeing the custom annotation below the SSID name in the Wifi settings screen. We are on ios 9 Beta 3, xcode 7 beta 3.
We have done these steps successfully:
@note 1 The application's Info.plist MUST include a UIBackgroundModes array * containing 'network-authentication'.
@note 2 * The application MUST set 'com.apple.developer.networking.HotspotHelper' * as one of its entitlements. The value of the entitlement is a boolean * value true.
Here's our code in the App. We are trying to annotate a SSID by the name of "Internet" by a text "Try Here". We get the log that the setConfidence method is called for SSID "Internet". Yet, we do not see the actual annotation in the Wifi selection screen.
We also tried to pass 'nil' for the options object which promised to show the App name as the default annotation. But we do not see that either. We get return 'true' for the call to method registerWithOptions() and we do get callbacks when we open the wifi settings screen
NSMutableDictionary* options = [[NSMutableDictionary alloc] init];
[options setObject:@"Try Here" forKey:kNEHotspotHelperOptionDisplayName];
dispatch_queue_t queue = dispatch_queue_create("com.myapp.ex", 0);
BOOL returnType = [NEHotspotHelper registerWithOptions:options queue:queue
handler: ^(NEHotspotHelperCommand * cmd) {
if(cmd.commandType == kNEHotspotHelperCommandTypeEvaluate || cmd.commandType == kNEHotspotHelperCommandTypeFilterScanList ) {
for (NEHotspotNetwork* network in cmd.networkList) {
if ([network.SSID isEqualToString:@"Internet"]){
[network setConfidence:kNEHotspotHelperConfidenceHigh];
NSLog(@"Confidance set to high for ssid:%@",network.SSID);
}
}
}
}];
=========================
Please help us to understand what we are missing ?
It seem it does not work exactly that way. A NEHotspotHelperCommand object actually expects a NEHotspotHelperResponse. You cannot modify the networks directly.
All your are missing in your code is the delivery of the NEHotspotHelperResponse.
Hope that helps. It's been over a month, but I just got cleared for this entitlement.
I have implemented the below code for authenticating and annotating the Wifi hotspot with "Connect to MyWifi" for SSID "TP-LINK" from within the app, It works fine.
Note: For the above code to work,
You first need to register your app as Hotspot Helper via email https://forums.developer.apple.com/thread/11807