|
Written by Ivan Fernandes
|
|
Tuesday, 23 March 2010 16:11 |
|
Many Cocoa methods use the NSError class in order to provide error feedback about their executions. In order to show the error, just use the code bellow:
- (void)logError:(NSError *)error {
NSArray* detailedErrors = [[error userInfo] objectForKey:NSDetailedErrorsKey];
if(detailedErrors != nil && [detailedErrors count] > 0) {
for(NSError* detailedError in detailedErrors) {
NSLog(@" DetailedError: %@", [detailedError userInfo]);
}
} else {
NSLog(@" %@", [error userInfo]);
}
}
|
|
Last Updated on Wednesday, 24 March 2010 05:08 |