How to check the internet connection in objective-c (xCode)

0 votes
578 views
asked Aug 15, 2014 in xCode by kalpana (3,995 points)
Hi

  How to check the internet connection in objective-c (xCode)

1 Answer

0 votes
answered Aug 15, 2014 by john (4,220 points)

Hi 

import "Reachability.h"
#import <SystemConfiguration/SystemConfiguration.h>
//Class.m
- (BOOL)connected 
{
    Reachability *reachability = [Reachability reachabilityForInternetConnection];  
    NetworkStatus networkStatus = [reachability currentReachabilityStatus]; 
    return networkStatus != NotReachable;
}
...