Last Updated: February 25, 2016
·
1.187K
· napolux

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;
}