Hi Readers,
The most simple way to know that the device is connected to the internet is :
NSURL *scriptUrl = [NSURL URLWithString:@"http://apps.wegenerlabs.com/hi.html"];
NSData *data = [NSData dataWithContentsOfURL:scriptUrl];
if (data)
NSLog(@"Device is connected to the internet");
else
NSLog(@"Device is not connected to the internet");
The URL points to an extremely small website that can be loaded fast in a cellular network.
If checking whether the device is somehow connected to the internet is everything you want to do,Then this method is the most simple way to do it.
*Thanks for Reading*
Keep Coding..:)
0 Comment(s)