How to Download the Reachability Sample
Apple provides a sample application called Reachability that shows how to determine whether you have an Internet connection for your iOS app (as well as quite a bit of additional network information). Here's how to use code from that valuable sample program:
Download the Reachability sample from Apple by clicking Sample Code.
Type Reachability in the Search field.
Click the Reachability project in the search results, and in the iOS Developer Library window that appears, click the Download Sample Code button.
In Safari downloads, double-click the Reachability folder to open it.
Open the disclosure triangle next to the Classes folder (or open the folder) and drag the Reachability.m and Reachability.h files into your project.
You can put them in your Supporting Files group just to keep them out of the way.
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 SystemConfiguration framework. To do so, follow these steps:
In the Project navigator, select the project icon (in this case, RoadTrip) at the top of the Project navigator content area to display the Project editor.
In the Targets section in the Project editor, select RoadTrip.
On the Summary tab, scroll down to the Linked Frameworks and Libraries section.
Expand the Linked Frameworks and Libraries section if it isn't already expanded (see the figure) by clicking the disclosure triangle.
Click the + (plus sign) button underneath the list of current project frameworks.
A list of frameworks appears.
Scroll down and select SystemConfiguration.framework, as shown in this figure.
Click the Add button.
You’ll see the framework added to the Linked Frameworks and Libraries section.
Close the Linked Frameworks and Libraries section.
In the Project navigator (don’t do this from the Linked Frameworks and Libraries section!), drag the SystemConfiguration.framework file (you can see it at the top of the Project Navigator in the figure) to the Frameworks group, as shown.
You can also add a framework by clicking the Build Phases tab in the Project editor, expanding the Link Binary with Libraries section, and following the same procedure.