SystemConfiguration: SCNetworkReachability callback is called redundantly

Originator:mxn
Number:rdar://22037883 Date Originated:28-Jul-2015
Status:Open Resolved:
Product:iOS SDK Product Version:
Classification:Other Bug Reproducible:Always
 
Summary:
The callback function passed into SCNetworkReachabilitySetCallback() is called when the callback is first registered with SCNetworkReachability, even if no change has taken place.

Steps to Reproduce:
1. Open the attached project, EachAbility, which is based on the Reachability sample project.
2. Build and run it on a simulator or device with Internet connectivity.

Expected Results:
The following message is logged to the console:

Initially reachable

Actual Results:
On iOS 8.4, the following message is logged to the console:

Initially reachable

On iOS 9 beta 4, however, the following messages are logged to the console:

Initially reachable
Now reachable

The second log message is not expected.

Version:
iOS 9.0 13A4305g in both Simulator and on the device

Notes:
Plenty of applications use some variation of Reachability and respond to network changes by, for instance, retrying network requests that failed or were deferred while offline. The extra call to the callback may cause unnecessary data usage in these applications, or bugs caused by an assumption that this callback is only called when the address’ reachability actually changes.

Configuration:
Simulator 9.0 (SimulatorApp-612 CoreSimulator-171) simulating iPhone 6, plus a real iPhone 6

Attachments:
'EachAbility.zip' was successfully uploaded.

Comments

Duplicate of 21882003 (Closed)


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!