Thursday, March 10, 2011

check inernet conection on iphone

NSString *connected = [NSString stringWithContentsOfURL:[NSURL URLWithString:@"http://www.google.com"]];

//NSLog(@" SRRINF IS %@",connected);


wait(20);

if (connected == NULL) {
NSLog(@"Not connected");

UIAlertView *alertb = [[UIAlertView alloc] initWithTitle:@"Internet is down " message:@"Check your internet connection" delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil,nil];

[alertb show];

[alertb release];
} else {
NSLog(@"Connected - %@",connected);

No comments:

FEEDJIT Live