I have a plist, where i have one dict with group (string) and records (array)
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>group</key>
<string>Home to Girlfriend</string>
<key>records</key>
<array>
<dict>
<key>date</key>
<string>24/08/2010</string>
<key>time</key>
<string>00:33:04</string>
</dict>
</array>
</dict>
</array>
</plist>
I want to add new group, and this make a records empty to be add records lately.
I make a code to add group and add records (array) empty.
But when i go to save records in this new group, it can't save.
My code to save a record, is just ok when a category that was previously created with some records itens.
This is the code to add new group!
Code:
-(IBAction)saveGroup {
nomeDoGrupo = nameGroup.text;
NSArray* meuArrayRecords;
meuArrayRecords = [NSArray arrayWithObjects: nil];
NSDictionary* novoGroup = [NSDictionary dictionaryWithObjectsAndKeys:
nomeDoGrupo, @"group",
meuArrayRecords, @"records",
nil];
[recordsArray addObject:novoGroup];
[recordsArray writeToFile:recordsArrayPath atomically:YES];
[self dismissModalViewControllerAnimated:YES];
}
This is the part of code to save records to a group
Code:
NSDictionary* meuGroupDict = groupDict;
NSMutableArray* meusRecordsArray = [meuGroupDict objectForKey:@"records"];
NSDictionary* novoRecords = [NSDictionary dictionaryWithObjectsAndKeys:
tempoString, @"time",
hoje, @"date",
nil];
[meusRecordsArray addObject:novoRecords];
[recordsArray writeToFile:recordsArrayPath atomically:YES];
[self dismissModalViewControllerAnimated:YES];
Can anyone help me?

Sorry for the english, i'm brazilian