Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • HOW TO CHECK IF AN INTERNET CONNECTION EXISTS ON iOS DEVICE

    • 0
    • 1
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 301
    Comment on it

    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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: