iOS13 NEHotspotConfiguration internal error

NEHotspotConfigurationManager working normally in iOS 12,


IOS 13 (13.0~13.3), in general, it works well, but sometimes internal error will appear,


In this case, I only restart the device to solve the problem.


NSString *ssid = @"***";
    NSString *password = @"***";
    
    if (@available(iOS 11.0, *)) {
        NEHotspotConfiguration * config = [[NEHotspotConfiguration alloc] initWithSSID:ssid passphrase:password isWEP:NO];
        
        [[NEHotspotConfigurationManager sharedManager] getConfiguredSSIDsWithCompletionHandler:^(NSArray * _Nonnull list) {
//            if( ![list containsObject:ssid] ){
                [[NEHotspotConfigurationManager sharedManager] applyConfiguration:config completionHandler:^(NSError * _Nullable error) {
                    NSLog(@"%@",error);
                }];
//            }
        }];
    } else {
        // Fallback on earlier versions

The same thing happened when I try get my WiFi SSID, anyway, I only get null.


After restarting the device, I can read the correct SSID


- (NSString*)fetchSSID
{
    NSString *wifiName = [NSString stringWithFormat:@""];
    CFArrayRef wifiInterfaces = CNCopySupportedInterfaces();
    if (!wifiInterfaces) {
        return wifiName;
    }
    NSArray *interfaces = (__bridge NSArray *)wifiInterfaces;
    for (NSString *interfaceName in interfaces) {
        CFDictionaryRef dictRef = CNCopyCurrentNetworkInfo((__bridge CFStringRef)(interfaceName));
        if (dictRef) {
            NSDictionary *networkInfo = (__bridge NSDictionary *)dictRef;
            wifiName = [NSString stringWithFormat:@"%@",[networkInfo objectForKey:(__bridge NSString *)kCNNetworkInfoKeySSID]];
            CFRelease(dictRef);
        }
    }
    CFRelease(wifiInterfaces);
    
    return wifiName;
}

We actually had this issue (internal error) on iOS 12 and it was fixed in a leter version. Now with iOS 13.3 it resurfaced.

If anybody else is also having this problem on iOS 13.3 it would be nice to know.


Regarding the SSID: If you don't have location permissions on iOS 13 you only get the SSID from networks you added yourself using NEHotspotConfiguration. If you did not manage to connect -> asking for the SSID will return nil / "WiFi"

We actually had this issue (internal error) on iOS 12 and it was fixed in a leter version.

Indeed.

Now with iOS 13.3 it resurfaced.

Bummer. Please make sure you file a bug about such misbehaviour. For problems like this, your only real option is to file a bug about it. When crafting your bug report:

  1. Install the Wi-Fi for iOS profile from our Bug Reporting > Profiles and Logs page.

  2. Likewise for the Location Services for iOS profile. That’s because iOS 13 couples Wi-Fi and location.

  3. Reproduce the problem.

  4. Make a note of the time.

  5. Trigger a sysdiagnose log.

  6. When that’s done, attach the log and your timestamp from step 3, to your bug report.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Of course, I know that I need location permission, otherwise I will not be able to read SSID after restarting the device. As I said above, it works normally, but sometimes , 'internal error' will be printed in the Xcode output.

This still exists in iOS 13.4

It's a little different.


CNCopySupportedInterfaces() is nil.


And Using NEHotspotConfigurationManager will throw

NEHotspotConfigurationManager Error Domain=NEHotspotConfigurationErrorDomain Code=13 "already associated."

An error like this could indicate that you have a weak association with your AP (Access Point), but something has gone wrong and so communication through that AP is not possible. If you are trying to associate with this AP again with the link still connected then this would explain the error you are seeing and why CNCopySupportedInterfaces is nil.


To avoid this, attempt your association, and if you error out, remove the configuration and try again after a small delay to ensure there are no collisions. If successful, check the SSID via CNCopyCurrentNetworkInfo and then proceed on with you AP communication.



Matt Eaton

DTS Engineering, CoreOS

meaton3 at apple.com

iOS13 NEHotspotConfiguration internal error
 
 
Q