8

I use NEHotspotConfigurationManager in a native module developed for a react native app, to connect to a device that exposes an open wifi hotspot. In older iOS versions (iOS 12 and lower) it worked fine, but in iOS 13 the device is being disconnected after a few seconds of being connected.

this is my native method, I use joinOnce as it makes sense according to the docs:

NEHotspotConfiguration* configuration = [[NEHotspotConfiguration alloc] initWithSSID:ssid];
configuration.joinOnce = true;

[[NEHotspotConfigurationManager sharedManager] applyConfiguration:configuration completionHandler:^(NSError * _Nullable error) {
  if (error != nil) {
    reject(ERR_HOTSPOT_CONFIGURATION, ERR_HOTSPOT_CONFIGURATION, error);
  } else {
    resolve(nil);
  }
}];

What is the proper way of keeping the connection up for longer periods of time? Is this an intended/documented change in iOS 13? Is it a bug?

Also, in Android if the hotspot does not have internet connectivity the system automatically switches to mobile network. Is this some similar policy in iOS? The device I am connecting to does not provide internet access

1 Answers1

9

This is a bug in newest iOS/iPadOS, similar to my report: iPadOS: Network connected via NEHotspotConfiguration disconnects after a while

I have reported it to Apple, but it has not yet been solved, and likely will not be solved by iOS 13 release (September 19th).

Workaround is to use joinOnce = false, but in this case, a user may be prompted to switch to cellular if internet connection is not detected. The user will not be switched automatically in the background, but switching to cellular is exposed as a preferred option.

  • Awesome, I could not comment on your SO question (which I took almost as a template as you may have noticed) so it is great to hear from you now. How can we be certain that it is a bug? Can you point me to any other docs or whatever link of other people having this issue? I'll try the `joinOnce = false` – martin aliverti Sep 17 '19 at 11:47
  • Correct, `joinOnce = false` fixes the problem. I haven't yet seen any side effect, but I'll keep this thread updated if I have any other findings. – martin aliverti Sep 17 '19 at 12:33
  • Pieces of documentation cited in my post suggest it is not an intended behaviour, since my valid use case is impossible to apply now - thus a bug. – Mateusz Chechliński Sep 17 '19 at 12:38
  • Also, I reported it via Feedback Assistant and it was not rejected. Too bad it has "resolution: open" for quite a long time - which basically means they intent to investigate it later. – Mateusz Chechliński Sep 17 '19 at 12:40
  • Looks like Apple fixed the issue in iOS 13.4 beta 2, works for me now with `joinOnce = true`. Related discussion on Apple's forum: https://forums.developer.apple.com/thread/122540 – Marc Feb 22 '20 at 18:16
  • @Marc Would you mind leaving an answer on my original question here: https://stackoverflow.com/questions/57552952/ipados-network-connected-via-nehotspotconfiguration-disconnects-after-a-while so I can accept your answer? – Mateusz Chechliński Feb 23 '20 at 09:07