Checking for Network Availability
One of the easiest ways to get your app rejected by Apple is to fail to make sure that you have an Internet connection when your app needs it, and therefore fail to notify the user that the functionality that requires the connection will be unavailable (or even worse, have your app just hang there).
Downloading the Reachability sample
Apple provides a sample application that shows how to determine whether you have an Internet connection (as well as quite a bit of additional network information I won’t be going into), and you’ll be using that code in the RoadTrip app developed in this book.
1. Download the Reachability sample from Apple by clicking Sample Code at
2. Type Reachability in the Search field.
3. Click the Reachability project in the search results, and in the iOS Developer Library window that appears, click the Download Sample Code button.
4. In Safari downloads, double-click the Reachability folder to open it.
5. Open the disclosure triangle next to the Classes folder (or open the folder) and drag the
files into your project.
(I put them in my Supporting Files group just to keep them out of the way.)
6. Select the check box in front of Road Trip in the Add to targets section.
Be sure to select the Copy Items into Destination Group’s Folder option (if it isn’t already selected).
In order for you to be able to use this code, you need to add the