I get this error when I want to alert user if there is no internet connection
Please help me, Here is my code:
- (void)viewDidAppear:(BOOL)animated
{
[super viewDidAppear:animated];
__block UIAlertView *alert = nil;
//---------- Check Connection -------
// allocate a reachability object
Reachability* reach = [Reachability reachabilityWithHostname:@"www.google.com"];
// set the blocks
reach.unreachableBlock = ^(Reachability*reach) // not connected
{
//NSLog(@"UNREACHABLE!");
alert =
[[UIAlertView alloc]
initWithTitle: @"No Network Connection!"
message:@"Sorry, we can't currently connect you to the app. Please check your internet connection."
delegate:nil
cancelButtonTitle:@"OK"
otherButtonTitles:nil];
[alert show];
//[alert release];
};
reach.reachableBlock = ^(Reachability*reach)
{
//NSLog(@"REACHABLE!");
};
// start the notifier which will cause the reachability object to retain itself!
[reach startNotifier];
}
The error is "wait_fences: failed to receive reply: 10004003" Any Suggestions?