esqew esqew - 8 months ago 32
iOS Question

Reachability Guide for iOS

Has anyone found a halfway decent guide to implementing Reachability on iOS?

Answer Source

I have implemented Reachability like this. Download and add Reachability.h and .m to your project. Add the SystemConfiguration framework to your project. #import "Reachability.h" where you want to use it. Use this code.

-(BOOL)reachable {
    Reachability *r = [Reachability reachabilityWithHostName:@""];
    NetworkStatus internetStatus = [r currentReachabilityStatus];
    if(internetStatus == NotReachable) {
        return NO;
    return YES;

When you want to check for reachability...

if ([self reachable]) {
else {
    NSLog(@"Not Reachable");

Here is the example project that I made.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download