Re: Still problems with storing preferences
Re: Still problems with storing preferences
- Subject: Re: Still problems with storing preferences
- From: Bill Haller <email@hidden>
- Date: Fri, 10 Oct 2003 01:02:45 -0400
If you have your self-made class implement the NSCoding protocol, you
will then be able to use NSArchive to save your NSMutableArray to file,
and NSUnarchive to restore it.
If protocols are new to you, they are predefined interfaces that you
declare you will implement in your class:
@interface MyBuddyListClass : NSObject <NSCoding>
So then later on you can save to file:
[NSArchiver archiveRootObject:buddyObject toFile:fileName];
The data is saved in some magical system independent binary format I
think, not sure. If you want your saved data human readable, I think
you have to stick to NSString and NSNumber and a couple of other basic
data types, then you can use the writeToFile:atomically method on the
array.
Hope this helps.
Bill H.
On Thursday, October 9, 2003, at 06:46 PM, Eivind Andersen wrote:
Is there anyone who can explain to me how I can store a
NSMutableArray, containing objects from a self-made class? If so, I
would be MOST thankful!
(If anyone wonderes...I'm totally new to both cocoa and objective-c:)
best regards,
Eivind Andersen
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.