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.
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.
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];
[myArray writeToFile:aFile atomically:YES];
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With