The core attributes of an NSError object—or, simply, an error object—are an error domain, a domain-specific error code, and a “user info” dictionary containing objects related to the error, most significantly description and recovery strings.
The core attributes of an NSError object are an error domain (represented by a string), a domain-specific error code and a user info dictionary containing application specific information.
The latest version of objective C is 2.0.
Looking at the NSError documentation tells me that you'll need to do something like:
NSLog(@"%@",[error localizedDescription]);
This should then give you human readable output
NSLog(@"Error: %@", error);
Gives me a null message
Then error
is nil
, not an NSError instance.
Here's a rough method I use to log errors while developing; (Not for Cocoa-touch)
// Execute the fetch request put the results into array
NSError *error = nil;
NSArray *resultArray = [moc executeFetchRequest:request error:&error];
if (resultArray == nil)
{
// Diagnostic error handling
NSAlert *anAlert = [NSAlert alertWithError:error];
[anAlert runModal];
}
NSAlert takes care of displaying the error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With