title: code to check internet is there or not for iphone
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/1083701/how-to-check-for-an-active-internet-connection-on-iphone-sdk">How to check for an active Internet Connection on iPhone SDK?</a>  </p>
  </blockquote>
  
  
  
  <p>I am worried if this code will be approved by apple for checking whether an internet connection exists.</p>
  
  <p>Now is this code is alright, or am I still missing something?  Edited code:</p>
  
  <pre><code>Reachability* reachability = [Reachability reachabilityWithHostName:@"www.apple.com"];
  NetworkStatus remoteHostStatus = [reachability currentReachabilityStatus];
  
  if(remoteHostStatus == NotReachable) { NSLog(@"not reachable");}
  else if (remoteHostStatus == ReachableViaWWAN) { NSLog(@"reachable via wwan");}
  else if (remoteHostStatus == ReachableViaWiFi) { NSLog(@"reachable via wifi");}
  </code></pre>