Re: Building NSObject question/Help
Re: Building NSObject question/Help
- Subject: Re: Building NSObject question/Help
- From: Des Courtney <email@hidden>
- Date: Wed, 25 May 2005 16:41:24 -0500
I was wondering if anybody had any idea's on what is needed so I can do
serialization with my custom NSObject so it will be stored/loaded when the
NSDictionary tries to store information out (I'm storing the NSDictionary in
my app prefs presently)
I noticed that Pictures seems to get stored some how, so I guess this is
possible some how ?.
Presently when I add my custom NSObject to NSDictionary and I try to store
it in my .app prefs, the NSDictionary doesn't get stored, so I guess there
something which it doesn't like. Take out my custom NSObject's and all is
OK.
Any Cocoa guru's out there.
Storing NSDictionary objects to user defaults or most other "native"
OS X formats has the restriction that the NSDictionary must be a
valid "property list." You are not allowed to store arbitrary
objects, but are limited to generic types like NSNumber and NSString.
The good news is that you should be able to store your NSObject via
archiving or convertion via an NSData object. You will need to
write some code that uses one of Cocoa's serialization mechanisms
to do this. I haven't yet need to do this myself, but there are
code examples on the 'Net involving using NSCoder or NSArchiver
to help do this.
Des
--
Des Courtney - Mascon Global, Ltd.
Computer Programmer - Macintosh Specialist
<mailto:email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden