Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Handling NSError in Objective

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 62
    Comment on it

    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:

    1. NSLocalizedDescriptionKey
    2. NSLocalizedFailureReasonErrorKey
    3. NSLocalizedRecoverySuggestionErrorKey
    4. NSLocalizedRecoveryOptionsErrorKey
    5. NSFilePathErrorKey
    6. NSStringEncodingErrorKey
    7. NSUnderlyingErrorKey
    8. NSRecoveryAttempterErrorKey
    9. 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)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: