Skip to content

Instantly share code, notes, and snippets.

@frr149
Created March 16, 2012 22:06
Show Gist options
  • Save frr149/2053122 to your computer and use it in GitHub Desktop.
Save frr149/2053122 to your computer and use it in GitHub Desktop.
-(NSString *) fetchStringFrom: (NSURL *) aURL error: (NSError **) err{
// Haz algo raro que pueda cascar
if (YES) {
// Se ha producido un error
NSDictionary *errorInfo = [NSDictionary dictionaryWithObject:NSLocalizedDescriptionKey
forKey:@"Error al hacer algo arriesgado"];
// recordad que se trata de una doble indirección, así que hay que usar *err
*err = [NSError errorWithDomain:@"Mi dominio"
code:100
userInfo:errorInfo];
return nil;
}
// Seguir con la ejecución y devolver la cadena que sea
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment