• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSKeyedArchiver now fails by returning bogus archive instead of raising exception
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Prev by Date: Re: Rearranging NSOutlineView via drag-and-drop
  • Next by Date: NSTableView binding and clickedRow returning -1
  • Previous by thread: Re: QuickLook Poll
  • Next by thread: NSTableView binding and clickedRow returning -1
  • Index(es):
    • Date
    • Thread