Unable to connect wifi using NEHotspotConfiguration

I am using NEHotspotConfigurationManager to connect wifi programmatically.

Its an open Network without any password I am using below code:


if (@available(iOS 11.0, *))

{

NEHotspotConfiguration *config = [[NEHotspotConfiguration alloc]initWithSSID:SSIDName];

[NEHotspotConfigurationManager.sharedManager applyConfiguration:config completionHandler:^(NSError* error)

{

if (error

)

{

printf([error description]);

} else

{

printf(@"success");

} }];


I am connecting to the hostpot/access point of one device, but every time I am getting an error of unable to join but in response it goes to success as the error is nil. Is there any thing I need to add in configuration or add in setting or am I missing anything ?

Replies

There’s two parts to this:

  • Why won’t the device join the network? (A)

  • Why don’t you get a meaningful error? (B)

With regards B, see this thread for an explaining of what’s going on there.

With regards A, if you join the same network manually, using Settings > Wi-Fi, does it work?

Share and Enjoy

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

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

Yes I tried to connect it manually and it worked there but issue occurs only when I try to connect it with NEHotspotConfiguration

Interesting. The fact that it failed after calling your completion handler with no error indicates that the failure is coming out of the Wi-Fi subsystem, not

NEHotspotConfigurationManager
itself (see this post for more background on that split). Unfortunately, that means there’s very little you can do about this at the API level.

Does this reproduce with the latest iOS 13 beta? If so, my advice is that you file a bug about it. Make sure to follow the instructions under Wi-Fi for iOS on our Bug Reporting > Profiles and Logs page.

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"

Yes, I checked with iOS beta 13 & 13.1 but the same issue occurs.

Yes, I checked with iOS beta 13 & 13.1 but the same issue occurs.

OK, then the next step is to file a bug about this, per my previous post.

Share and Enjoy

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

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

Yes I posted the feedback and sent logs too.


https://feedbackassistant.apple.com/feedback/7219960

Hi,


We are also facing the same issue where NEHotspotConfiguration does not report any error but 'Unable to join the network...' error pops up when we try to connect to a WiFi network created by an IOT device. Is there any activity on the bug you reported?


Regards,

Anutosh.

Not yet

Hi eskimo,


Any updates ?

Any updates ?

If there were, you’d get them via the feedback system.

Share and Enjoy

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

let myEmail = "eskimo" + "1" + "@apple.com"
(r. 55107978)

Added ticket also, Ticket number is "7024746"


But I didn't get any response over there.

FYI - we are also unable to connect [or at least it is very unreliable, and slow if it does succeed] when using NEHotspot, but have success when Manually connecting.


We are currently using iOS beta 13.3


***********************************************

Removal of a couple of breakpoints, and uncommenting some 'tests' has resulted in a success - we are now able to connect via NEHotspotConfiguration, and establish Socket connections efficiently using iOS beta 13.3

***********************************************

I am still facing this issue now.😢

My app uses the `NEHotspotConfigurationManager` to connect specific Wi-Fi hotspot. Most of the time it works fine, but sometimes this method return "internal error". And then this connection API will never work unless restarting device.


Some additional information:

When `applyConfiguration` return error, the related APIs doesn't work too.

> In block of `[[NEHotspotConfigurationManager sharedManager] getConfiguredSSIDsWithCompletionHandler:^(NSArray<NSString *> * _Nonnull wifiList) { }];`, wifiList is nil, even if there were several ssid name in list before the error occurring.

> `CNCopyCurrentNetworkInfo` return nil.


And I find out this issue appears more frequently on iPhoneX iOS 13.x.

Hope this issue can be fixed in next version. Thanks.

While this seemed fixed in iOS 13.2.x it resurfaced for us with iOS 13.3.


Anybody else also facing these issues on the latest version?

Hey,


did you finally get any feedback on https://feedbackassistant.apple.com/feedback/7219960 ?


I am facing a similiar issue.

https://forums.developer.apple.com/thread/130480