Skip to content

Instantly share code, notes, and snippets.

@frr149
Created March 16, 2012 22:20
Show Gist options
  • Save frr149/2053241 to your computer and use it in GitHub Desktop.
Save frr149/2053241 to your computer and use it in GitHub Desktop.
NSError *err = nil;
NSURL *aURL = [NSURL URLWithString:@"http://www.google.com"];
NSString *contents = [NSString stringWithContentsOfURL:aURL
encoding:NSUTF8StringEncoding
error:&err];
// Esto sí que es correcto: inspeccionar el valor del retorno
if (!contents) {
// Seguro que ha habido un error
NSLog(@"Ahora sí que se ha producido un error:%@", err.localizedDescription);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment