views:

871

answers:

4

this question is regarding xcode objective c and iphone development:

So i want to store an array in a new plist file and I know how to retrieve the file path and write the data into the file (at least i think i do) and all that jazz once the plist is created, but how do I actually create the plist file the first time the app is run or the first time I go to enter data into it? I want it to live in the documents folder of my app.

I'm assuming this is pretty simple I just can't seem to find documentation on it.

A: 

[myArray writeToFile:aFile atomically:YES];

Dave DeLong
+4  A: 

To save:

NSMutableArray *array = [[NSMutableArray alloc] init];
[array writeToFile:[@"/path/to/file.plist"] atomically: TRUE];

To retrieve:

NSMutableArray *array = [[NSMutableArray arrayWithContentsOfFile:[@"/path/to/file.plist"]] retain];
leson
+2  A: 

Apple's guide to creating plist's programmatically

Does a pretty good job explaining what a plist is and how to structure it to your liking.

Convolution
you can just say RTFM.
Joseph Silvashy
lolz...I really searched for the topic. It goes for me too...RTFM
Ayaz Alavi
A: 

I ended up using NSKeyedValue there was a great tutorial here:

http://vimeo.com/1454094

I know technically this is not the answer to the question but it did solve my problem.

nickthedude