Skip to content

Instantly share code, notes, and snippets.

@quellish
Created September 20, 2014 19:22
Show Gist options
  • Select an option

  • Save quellish/cb45944282d161d7ca78 to your computer and use it in GitHub Desktop.

Select an option

Save quellish/cb45944282d161d7ca78 to your computer and use it in GitHub Desktop.
Example of correct checking of connection errors in objective-c
[NSURLConnection sendAsynchronousRequest:request queue:[self connectionQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
if (response != nil){
/// Yay, we were able to connect!
} else {
[self presentError:connectionError];
}
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment