I get the following exception when trying to unzip when using Swift:
Application termination due to the uncaught exception "NSInvalidUnarchiveOperationException", reason: "*** - [NSKeyedUnarchiver decodeObjectForKey:]: cannot decode the class object (NSKnownKeysDictionary1) for the key (NS.objects); the class can be defined in the source code or library, which is not connected "
Context: I am creating the "Share Links" extension. In my main application (written in Objective-C), I write out an array of dictionaries with link information using MMWormhole.
NSFetchRequest* bookmarkFetch = [NSFetchRequest fetchRequestWithEntityName:@"XX"]; bookmarkFetch.propertiesToFetch = @[ @"name", @"text", @"date", @"url" ]; bookmarkFetch.resultType = NSDictionaryResultType; NSArray* bookmarks = [moc executeFetchRequest:bookmarkFetch error:NULL]; [wormhole passMessageObject:bookmarks identifier:@"XXX"];
Values โโin the array: NSStrings and NSDate.
In the bowels of MMWormhole you get:
NSData *data = [NSKeyedArchiver archivedDataWithRootObject:messageObject];
messageObject is just an array of bookmarks without intermediate processing.
In extension I:
let wormhole = MMWormhole(applicationGroupIdentifier: "group.XX", optionalDirectory:nil) let bookmarks = wormhole.messageWithIdentifier("XXX") as? Array<Dictionary<String,AnyObject>>
messageWithIdentifier: ultimately calls this:
id messageObject = [NSKeyedUnarchiver unarchiveObjectWithData:data];
The matrix is โโcorrectly written to the application group folder - I can read it using another extension written in Objective C.
This exception appears when I run the simulator. When working on a 32-bit device (iPhone 5 and iPad 3), the code works correctly. I currently do not have a 64-bit device for testing.
I suppose I'm missing an import or framework, but which one?