0

I have a class called Shop that contains data members (NSString, NSInteger and NSMutableArray that contain another class (that also has NSString and NSInteger).
Now if I use NSMutableArray to hold a list of Shops, what is the best way to save the list to a file and load it later?
Again the class Shop contains data members that is another class; both of the classes have NSString and NSInteger (maybe also NSData and NSDate).

I heard something about archiver??

Thanks.

Neeku
  • 3,646
  • 8
  • 33
  • 43
Amir
  • 455
  • 2
  • 8
  • 19
  • possible duplicate of [problem writing a NSMutableArray to file in cocoa](http://stackoverflow.com/questions/751093/problem-writing-a-nsmutablearray-to-file-in-cocoa) – bbum Jun 13 '10 at 14:02

1 Answers1

1

Exact same as problem writing a NSMutableArray to file in cocoa

You have non-plist objects in your array and need to use NSArchiver.

Community
  • 1
  • 1
bbum
  • 162,346
  • 23
  • 271
  • 359
  • I still didnt understand , does NSArchiver will save all of NSArray list of Shops object to file? (even if Shop have data member like NSArray ) ?? what the difference between NSArchiver to Serializing? – Amir Jun 13 '10 at 15:31
  • Did you read this document http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Archiving/Archiving.html that was linked to in the dupe's answer? – bbum Jun 13 '10 at 20:38