I would like to save an NSArray either as a file or possibly use user defaults. Here’s what I am hoping to do.
- Retrieve already saved NSArray (if any).
- Do something with it.
- Erase saved data (if any).
- Save the NSArray.
Is this possible, and if so how should I do this?
NSArray provides you with two methods to do exactly what you want:
initWithContentsOfFile:andwriteToFile:atomically:A short example might look like this: