views:

27

answers:

1
+1  Q: 

Array writeToFile

Let's say I create an object like this:

Person:
NSString *name;
NSString *phone;
NSString *address

I create several of these objects. Then I create an NSMutableArray called people and store them in there.

Can I save this array to disk with Array writeToFile? Does it need to be converted to NSData?

+1  A: 

Any objects in your NSArray must be an NSString, NSDate, NSArray, NSDictionary, NSNumber or NSData for writeToFile to succeed.

Yes, you will need to archive each Person object to an NSData object before you put it into the array.

TomH
What do you mean by converting it to NSData before putting it into the array? You mean before writing to disk?
awakeFromNib
TomH