NEHotspotConfigurationManager.apply(_:completionHandler:) always attempts to join network configured with SSID contrary to documentation

Originator:brandon
Number:rdar://40488313 Date Originated:2018/5/23
Status:Closed Resolved:
Product:Network Extensions Framework Product Version:11.3 (15E216)
Classification:Bug, UI/Usability Reproducible:Always
 
Area:
Network Extensions Framework

Summary:

The behaviour of NEHotspotConfigurationManager.apply(_:completionHandler:) makes it easy for app developers to let users join a network without their app becoming involved in the management of network associations. The documentation for this method states:

> This method attempts to join the network only if it's found nearby. Also, because of the noticeable delay that the Hotspot 2.0 discovery mechanism may incur, the method doesn't attempt to join Hotspot 2.0 networks.

It seems there's some nuance to this behaviour, but more importantly a network configured with an SSID will always attempt to associate with the network when the user grants permission, even if the network isn't found nearby. This leads to a failure alert being shown to the user.

The nuance I mentioned is that the current behaviour I see is:

- Network configured with SSID will _actively_ attempt to join the new network, even if the device is currently associated with a different one
- Network configured with HS2 will auto-join the new network only if the device isn't already associated with a network

This sounds like the second sentence I quoted, but the way it's worded in the documentation wasn't immediately clear that it meant this.

Steps to Reproduce:

1. Apply a configuration with an SSID that isn't nearby
2. As a user, allow joining the new network
3. Observe that joining fails

Expected Results:

A network configured with an SSID should not attempt to join the network if it isn't found nearby.

Actual Results:

Networks configured with an SSID always attempt to join the network, even if they're not nearby, which always fails.

Version/Build:

11.3 (15E216)
iPhone 6S

Comments

I purpose a new 'check' method to do this

https://openradar.appspot.com/40288319

Thank you for your reply to clarify the intended behaviour for SSID networks. The goal you described aligns with what I would expect this API to do and our needs for the app that we're making. The conflation of scanning for networks and joining the configured network seems unique here and less aligned with our needs though.

Our use case allows users to download the app from anywhere, and they may not be near our network. We want them to be able to configure the network so the device associates when it's nearby. An alert informing them that joining the network failed when it's not nearby is potentially confusing, since they shouldn't be able to associate with it in their current location (and we don't want to create that impression) but association should succeed when the network is nearby. The documented behaviour is better matched to our needs, where applying the configuration should succeed if the user allows it, and joining should only occur during application if the network is nearby.

The expected behaviour you described is still contrary to the documentation, though, which reads:

This method attempts to join the network only if it's found nearby.

You wrote:

The scanning this network is a part of the joining this network, and since scan does not find this network nearby, it fails.

It seems like there's a chicken and egg problem between the expected behaviour and what's documented, where the device can only know if the network is nearby by scanning networks, but the expectation is that if scanning doesn't find the network then joining has failed altogether.

Given this behaviour is expected, my original suggestion of:

A network configured with an SSID should not attempt to join the network if it isn't found nearby.

should probably be a documentation change that better describes the expected behaviour:

This method always attempts to join networks configured with an SSID, regardless of whether they're nearby.

Apple Developer Relations

Engineering has determined that this issue behaves as intended based on the following information: The goal here is to attempt to join the network if the configuration gets installed successfully and user approves it. The scanning this network is a part of the joining this network, and since scan does not find this network nearby, it fails. This is an expected behavior.


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!