Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception NSInconsistentArchiveException doesn't exist on iOS #3

Open
adib opened this issue Aug 6, 2014 · 3 comments
Open

Exception NSInconsistentArchiveException doesn't exist on iOS #3

adib opened this issue Aug 6, 2014 · 3 comments

Comments

@adib
Copy link
Contributor

adib commented Aug 6, 2014

The method primitiveExtensibleProperties refers to an exception named NSInconsistentArchiveException which doesn't seem to exist on iOS SDK as of 7.1 – I recommend to use the string value instead on iOS, like so:

- (NSMutableDictionary *)primitiveExtensibleProperties;
{
    // Fault in the properties on-demand
    if (!_extensibleProperties)
    {
        @try {
            _extensibleProperties = [[NSMutableDictionary alloc] initWithDictionary:self.archivedExtensibleProperties];
            NSAssert(_extensibleProperties, @"-initWithDictionary: let me down");
        }
        @catch (NSException *exception) {
            // Catch and handle the exception by resetting properties to be empty. But then rethrow
            // the exception since the reset is only desirable if client code catches the exception
            // itself and chooses to proceed.
#if TARGET_OS_IPHONE
            if ([exception.name isEqualToString:@"NSInconsistentArchiveException"]) {
#else
            if ([exception.name isEqualToString:NSInconsistentArchiveException]) {
#endif // TARGET_OS_IPHONE
                NSLog(@"Resetting extensible properties after failure to unarchive: %@", self);
                _extensibleProperties = [[NSMutableDictionary alloc] init];
            }

            @throw exception;
        }
    }

    return _extensibleProperties;
}
@mikeabdullah
Copy link
Collaborator

Do you have any evidence that exception ever happens on iOS? My inclination is to let it throw until there's a concrete case to worry about.

@adib
Copy link
Contributor Author

adib commented Aug 6, 2014

No evidence. Maybe just #if it out on iOS?

Thanks

Sasmito Adibowo
http://basilsalad.com
+65 8135 8937

On 6 Aug, 2014, at 17:18, Mike Abdullah [email protected] wrote:

Do you have any evidence that exception ever happens on iOS? My inclination is to let it throw until there's a concrete case to worry about.


Reply to this email directly or view it on GitHub.

mikeabdullah added a commit that referenced this issue Aug 8, 2014
@mikeabdullah
Copy link
Collaborator

Agreed, and changed in commit 149dae1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants