iphone - Reachability Guide for iOS -
has found halfway decent guide implementing reachability on ios?
i have implemented reachability this. download https://developer.apple.com/library/content/samplecode/reachability/introduction/intro.html , add reachability.h , .m project. add systemconfiguration framework project. #import "reachability.h" want use it. use code.
-(bool)reachable { reachability *r = [reachability reachabilitywithhostname:@"enbr.co.cc"]; networkstatus internetstatus = [r currentreachabilitystatus]; if(internetstatus == notreachable) { return no; } return yes; }
when want check reachability...
if ([self reachable]) { nslog(@"reachable"); } else { nslog(@"not reachable"); }
here example project made. http://dl.dropbox.com/u/3656129/reachabilityexample.zip
Comments
Post a Comment