I am trying to read and I also need to write to a plist.
So far I am trying to simply read the contents in.
Here is my appSettings.plist:

NSBundle* bundle = [NSBundle mainBundle];
NSString* plistPath = [bundle pathForResource:@"appSettings" ofType:@"plist"];
NSDictionary *tmp = [[NSDictionary alloc] initWithContentsOfFile:plistPath];
I tried to do this:
NSArray *mruItems = [[NSArray alloc] initWithArray:[tmp objectForKey:@"lastSearches"]];
But it throws an error. A check I did on the [tmp objectForKey:@”lastSearches”] type revealed this is not an NSArray…
How can I read the contents into my NSArray?
Thanks!
(I would love to have some info on writing too)
If you look at the screenshot above you see that it’s pretty clear that “lastSearches” is a Dictionary, not a list. You can try to switch the type there to a Array type instead and it should work for you.
Another solution would be to iterate over the keys in that dictionary:
Note that this would not be in order, and you probably would have to sort before iterating over it.