iPhone devsugar: Improved Network Reachability routines
Developers need to integrate this process into their apps. If your app connects to a server, for example, it must test the current iPhone configuration and report to the user whenever the network cannot be reached. Apple provides sample code to help with this.
iPhone developer Andrew Donoho was not particularly impressed by Apple's sample reachability code. So he decided to do something about it. He has created an open source, BSD-licensed update, which he posted on his website. His updated reachability utilities fix a few Apple misspellings and tunes up the code, allowing you to revert to the original implementation via compiler flags.
You can easily download his update and integrate it into your iPhone applications. His write-up describes the testing process and offers an implementation process for successive network tests. You build your decision tree and user feedback off the results of each test. Donoho has provided this code to allow others to build off his work without having to re-invent the entire process from Apple's original source.
If you're interested in a slightly different take on reachability, you might also want to take a peek at my UIDevice Extension category, which provides a number of other approaches to Reachability checks. Among other features, the category includes a WiFi check and hooks that allow you to change reachability status from within your application. As noted in the code, these Airplane Mode hooks are for testing only and not App Store safe.
Subscribe to Newsletter
Software Updatesmore updates
- Dropbox adds support for TouchID
- YouTube for iOS gets updated with full support for iPhone 6 and 6 Plus
- iOS 8.0.1 update now available (Updated -- Don't update!)
- NFL Mobile updated for 2014 Season with new Fantasy Football features, NFL Now integration
- Yahoo Mail improves email inbox searching with new filtering options
- Ember for Mac gains 'hugely-requested' screen recording feature