I have a NSURL like so:
NSURL *url = [NSURL URLWithString:@"http://jamessuske.com/isthedomeopen/isthedomeopenGetData.php"];
but if there is no internet connect or phone signal, my app crashes. Is there away to test the connect first before use?
Would I have to do try and catch? I have been reading about NSURLConnection, but I am unclear on how it works. Any ideas?
The error I am getting is Thread 6:signal SIGABRT I have no idea what this means, I have tried all the examples below and none worked.
I added this:
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    // release the connection, and the data object
    // receivedData is declared as a method instance elsewhere
    [connection release];
    // inform the user
    UIAlertView *didFailWithErrorMessage = [[UIAlertView alloc] initWithTitle: @"NSURLConnection " message: @"didFailWithError"  delegate: self cancelButtonTitle: @"Ok" otherButtonTitles: nil];
    [didFailWithErrorMessage show];
    [didFailWithErrorMessage release];
}
and I unplugged my Mac from the internet and ran my app on the simulator and this appears Thread 6:signal SIGABRT
I have used this code below
Reachability *networkReachability = [Reachability reachabilityForInternetConnection];
    NetworkStatus networkStatus = [networkReachability currentReachabilityStatus];
    if (networkStatus == NotReachable) {
        dispatch_async(dispatch_get_main_queue(), ^{
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Announcement" message: @"No Connection" delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release];
        });
    } else {
        dispatch_async(dispatch_get_main_queue(), ^{
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Announcement" message: @"Connection" delegate: nil cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release];
        });
Works when I am connected to the enter, but when I turn off my internet I get this error and the else alert does not appear
Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'data parameter is nil'
 
     
     
     
    