Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS 13: Network connected via NEHotspotConfiguration disconnects after a few seconds

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

like image 476
martin aliverti Avatar asked Sep 11 '19 17:09

martin aliverti


1 Answers

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.

like image 102
Mateusz Chechliński Avatar answered Oct 20 '22 01:10

Mateusz Chechliński