Check connection availability on iOS (the simple way)
-(BOOL)connectedToNetwork {
NSURL* url = [[NSURL alloc] initWithString:@"http://google.com/"];
NSData* data = [NSData dataWithContentsOfURL:url];
if (data != nil)
return YES;
return NO;
}
Written by Francesco Napoletano
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Internet connection
Authors
e0d
9.835K
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#