Archiving Object

Member
Posts: 196
Joined: 2003.10
Post: #1
Hello all,

I have a doc-based cocoa app, and I want to simply archive an object, much like how a NIB archives them. I want a simple way - nothing complicated. Any advice on this?
Quote this message in a reply
Member
Posts: 257
Joined: 2004.06
Post: #2

The brains and fingers behind Malarkey Software (plus caretaker of the world's two brattiest felines).
Quote this message in a reply
Member
Posts: 208
Joined: 2005.04
Post: #3
also, if the object you're trying to archive is an NSArray or an NSDictionary, you can use writeToFile:atomically: to save the object as a .plist file. This is convenient because it's human readable.
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #4
That even works with nested arrays, dictionaries, and basic objects (like NSNumber, NSString, etc)

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Member
Posts: 196
Joined: 2003.10
Post: #5
It's a custom Class. To invoke NSArchiver on it seems to tell me that I need to denote some NSEncoder method in my custom class?!
Quote this message in a reply
Member
Posts: 370
Joined: 2002.04
Post: #6
You have to implement the NSCoding protocol - check the docs on archiving.

Did you ever wonder why we had to run for shelter when the promise of a brave new world unfurled beneath the clear blue sky?
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  Pointers & Archiving in Cocoa Shivers 6 3,925 Apr 4, 2005 02:36 AM
Last Post: DoG