Reachability Sample Code Incorrectly Reports WWAN connections as WiFi Connections

Originator:jaredsinclair.rn
Number:rdar://15648111 Date Originated:12-Dec-2013 01:38 PM
Status:Open Resolved:
Product:Documentation Product Version:N/A
Classification:Serious Bug Reproducible:Always
 
Summary:
Reachability Sample Code Incorrectly Reports WWAN connections as WiFi Connections

Steps to Reproduce:
Visit the sample code here:
https://developer.apple.com/library/ios/samplecode/Reachability/Listings/Reachability_Reachability_m.html#//apple_ref/doc/uid/DTS40007324-Reachability_Reachability_m-DontLinkElementID_8

Inspect lines 218 and 232 in Reachability.m to see the error. A NetworkStatus value is being cast to a BOOL, which causes WWAN connections to be reported as WiFi connections to the loss of integer precision.

To fix the bug, change the lines from:

BOOL returnValue = NotReachable;

to instead read:

NetworkStatus returnValue = NotReachable;

Comments


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!