I have a plist file that has an array of dictionaries. Each dictionary item has a string item and an array of strings.
- Array
- Dictionary1
- key1: String
- key2: Array
-String1
-String2
- Dictionary2
- key1: String
- key2: Array
-String1
I tried to add a new dictionary item by executing the following line of code:
NSMutableArray *array2 = nil;
id Dictionary3 = [NSDictionary dictionaryWithObjectsAndKeys: key1, @"key1_string", array2, @"key2"];
[Array insertObject

ictionary3 atIndex:[Array count]];
Is this ok or am I completely off the track here?
Should I use NSMutableDictionary instead?
Should I do NSMutableArray *array2 = [NSNull null]; ? but this resulted in Warning when compiled
Then when I try to add a new item to array2, I have the following codes:
NSString *newStr = @"New String Item";
NSMutableDictionary *dict3 = [Array objectAtIndex:[Array count]];
NSMutableArray *key2Array = [dict3 valueForKey:@"key2"];
NSInteger count = [key2Array count];
[array insertObject:newStr atIndex:count];
This failed to add the newStr object to Array-Dict3.
If I added the newStr to Array-Dictionary1 or 2, this worked just fine.
What am I missing here? I'd appreciate any help. Thanks.