Reachability with IP address won't work.

2 Solutions Collect From Internet About “Reachability with IP address won't work.”

struct sockaddr_in is a low-level “socket address” type used by BSD sockets. We generally don’t deal with them at the Cocoa level, but they can creep up from time to time, including in Apple’s demo class. The reason there is because SCNetworkReachability uses a struct sockaddr_in in one of its creation functions.

Fortunately for you, however, you can supply a string instead with the +reachabilityWithHostName: method, and that includes IP addresses (which, like hostnames, will be resolved automatically for you by the underlying network APIs.)

Reachability *r = [Reachability reachabilityWithHostName:@""];

Please try the following:

if ([[Reachability reachabilityForInternetConnection] currentReachabilityStatus] == NotReachable) {
        // do somehting meaningful!

or to be more specific:

Reachability* reachability = [Reachability sharedReachability];
[reachability setHostName:@""]; // set your host name/ip here
NetworkStatus remoteHostStatus = [reachability remoteHostStatus];

if (remoteHostStatus == NotReachable) { NSLog(@"no"); }
else if (remoteHostStatus == ReachableViaWiFiNetwork) { NSLog(@"wifi"); }
else if (remoteHostStatus == ReachableViaCarrierDataNetwork) { NSLog(@"cellular"); }