• 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
NSArchiver and NSKeyedArchiver
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSArchiver and NSKeyedArchiver


  • Subject: NSArchiver and NSKeyedArchiver
  • From: "D.K. Johnston" <email@hidden>
  • Date: Sun, 21 Sep 2008 20:21:49 -0700

I wrote a class that conforms to the NSCoding protocol. I used encodeObject:forKey and decodeObjectForKey: in the required methods.

By mistake I used NSArchiver to archive one of the class instances. It compiled with no trouble; but then, not surprisingly, I got an exception when I ran it:

*** Terminating app due to uncaught exception 'NSInvalidArgumentException'
reason: '*** -encodeObject:forKey: only defined for abstract class. Define -[NSArchiver encodeObject:forKey:]!'


The fact that I should have used NSKeyedArchiver instead of NSArchiver isn't obvious from the message. (At least it's not obvious to me.) Can anything be done to ensure users of the class use NSKeyedArchiver, besides putting a comment in the header file?

Thanks etc.
dkj
_______________________________________________

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


  • Follow-Ups:
    • Re: NSArchiver and NSKeyedArchiver
      • From: "Michael Ash" <email@hidden>
    • Re: NSArchiver and NSKeyedArchiver
      • From: Mike Abdullah <email@hidden>
  • Prev by Date: Suggesting a user name for NSURLConnection
  • Next by Date: [SOLVED] Did I find a NSScanner bug, or am I doing this all wrong?
  • Previous by thread: Suggesting a user name for NSURLConnection
  • Next by thread: Re: NSArchiver and NSKeyedArchiver
  • Index(es):
    • Date
    • Thread