Error in Objective treated as Object and inherited NSObject.
NSError object encapsulate three types of information
1) Code - Nsinteger value which give the errors unique identifier
2) Domain - NSString value having error domain
3) userInfo - NSdictionary instance that have application specific information related to that error
Following is the list of the standard NSError userInfo keys:
- NSLocalizedDescriptionKey
- NSLocalizedFailureReasonErrorKey
- NSLocalizedRecoverySuggestionErrorKey
- NSLocalizedRecoveryOptionsErrorKey
- NSFilePathErrorKey
- NSStringEncodingErrorKey
- NSUnderlyingErrorKey
- NSRecoveryAttempterErrorKey
- NSHelpAnchorErrorKey
Here is the Usage of NSError
NSError *error = nil;
BOOL success = [[NSFileManager defaultManager] moveItemAtPath:@"path"
toPath:@"destinationpath"
error:&error];
if (!success) {
NSLog(@"%@", error);
}
0 Comment(s)