3 Replies
      Latest reply on Jan 18, 2020 11:58 PM by hanabi
      hanabi Level 1 Level 1 (0 points)

        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;
        }
        • Re: Sometimes NEHotspot doesn't work
          M_Bischof Level 1 Level 1 (0 points)

          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"

            • Re: Sometimes NEHotspot doesn't work
              eskimo Apple Staff Apple Staff (12,715 points)

              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"

              • Re: Sometimes NEHotspot doesn't work
                hanabi Level 1 Level 1 (0 points)

                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.