Reputation: 1627
I'm new to development and Im trying to create a simple dictionary app for personal use on the iPhone. For context, my question is a follow up to this one that some of you were kind enough to answer yesterday.
Is it possible to create a method that:
Any help or example code would be greatly appreciated!
Upvotes: 2
Views: 214
Reputation: 27147
Formatting the text file to be a useful data structure and parsing it would be the hardest part. But, as long as your NSArray
or NSDictionary
contain only plist
serializable objects, like NSString
s consider just using simple serialization.
You could use this to save: (Where array is the array to save and path is an NSString of the file path)
[array writeToFile:path atomically:YES];
And this to load from the file:
NSArray *array = [NSArray arrayWithContentsOfFile:path];
You could also use NSJSONSerialization
to create and structured string and save it through more general means.
Upvotes: 2