We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, any suggestions to fix crash and swift usage.
Bellow the implementation of suggestions.
+ (nullable instancetype)objectWithContentsOfFile:(NSString *)filePath { //load the file NSData *data = [NSData dataWithContentsOfFile:filePath]; //attempt to deserialise data as a plist id object = nil; if (data) { NSPropertyListFormat format; object = [NSPropertyListSerialization propertyListWithData:data options:NSPropertyListImmutable format:&format error:NULL]; //success? if (object) { //check if object is an NSCoded unarchive if ([object respondsToSelector:@selector(objectForKeyedSubscript:)] && ((NSDictionary *)object)[@"$archiver"]) { @try { object = [NSKeyedUnarchiver unarchiveObjectWithData:data]; } @catch (NSException* exception) { NSLog(exception); // delete corrupted archive // initialize libraryDat from scratch } } } else { //return raw data object = data; } } //return object return object; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi, any suggestions to fix crash and swift usage.
Bellow the implementation of suggestions.
The text was updated successfully, but these errors were encountered: