NSKeyedArchiver now fails by returning bogus archive instead of raising exception
NSKeyedArchiver now fails by returning bogus archive instead of raising exception
- Subject: NSKeyedArchiver now fails by returning bogus archive instead of raising exception
- From: Jerry Krinock <email@hidden>
- Date: Sun, 04 Jan 2015 23:55:01 -0800
In the past, if I passed an object which was not encodeable, for example, an NSManagedObject, or a collection containing such an object, to -[NSKeyedArchiver archivedDataWithRootObject:], it would raise an exception and print a warning to the console.
Now, if I pass it an unencodeable object, it instead happily returns an NSData object which will in turn happily return nil when passed to +[NSKeyedUnarchiver unarchiveObjectWithData:]. If I pass it a collection containing an unencodeable object, it also happily returns an NSData object, but this one, when passed to +[NSKeyedUnarchiver unarchiveObjectWithData:], will raise an exception complaining the count of objects is less than the count of keys.
Although I haven’t isolated this in a demo project, I think this new behavior started either in Yosemite, or with the 10.10 SDK. There is no mention of it in the Yosemite Foundation Release Notes. The documentation of -[NSKeyedArchiver archivedDataWithRootObject:] has never made any mention of what happens if you pass it an unencodeable object, so, legally speaking, any behavior is “expected” :(
Jerry
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden