tags:

views:

55

answers:

5

how to check internet connection through iphone or objective-c.???

A: 

Quick and Drity: Ping Google?

Bobby
A: 

Looks like the answer to your question can be found here

Lee
A: 

Apple's recommendation is to do something like (or use) Reachability

Prakash
A: 

Have a look at the apple sample code Reachability. It should provide you with everything you need.

Mick Walker
+1  A: 

Here is a code snippet you can use:

[[Reachability sharedReachability] setHostName:@"example.com"];
if ([[Reachability sharedReachability] remoteHostStatus] == NotReachable) {
 UIAlertView *dialog = [[[UIAlertView alloc] init] retain];
 [dialog setTitle:@"Server unreachable"];
 [dialog setMessage:@"The server is temporarily unavailable."];
 [dialog addButtonWithTitle:@"OK"];
 [dialog show];
 [dialog release];
}
Vincent Osinga