Friday, May 3, 2013

NSKeyedUnarchiver NSInvalidUnarchiveOperationException example ios


Names of exceptions that are raised by NSKeyedUnarchiver if there is a problem extracting an archive.
NSString *NSInvalidUnarchiveOperationException;
Constants
NSInvalidUnarchiveOperationException
The name of the exception raised by NSKeyedArchiver if there is a problem extracting an archive.


Example of [NSKeyedUnarchiver NSInvalidUnarchiveOperationException]
@try {
    self.libraryDat = [NSKeyedUnarchiver unarchiveObjectWithFile:filePath];
} @catch ( NSInvalidUnarchiveOperationException *ex ) {
    //do whatever you need to in case of a crash
} @finally {
    //this will always get called even if there is an exception
}