In-depth look into Apple reachability API

Mike Ash’s tutorial on the Reachability API sets the scene:

Imagine you start an iPhone app in a tunnel with no cell service. It tries to load data, but it fails. It gives you a weird error. You leave the tunnel, but the app is still showing the error. You tap the reload button, hoping that it was just the loss of signal that caused the problem, and it loads.

Now imagine the same scenario, but with an app that uses the reachability API. It notices that there is no internet connection, and doesn’t try to load data in the first place. It instead displays an informative message about requiring internet access. Once you leave the tunnel and obtain a signal again, the app automatically loads its data without any intervention, and you go on to use the app.

With that setup, Mike walks through the Reachability API, callback structure and the flags that indicate the reachability of a destination.