My writeToFile is not saving my data to my .plist.
- (IBAction)clickBtnDone:(id) sender {
NSLog(@"Done");
if ([txtGroupName.text length] > 0) {
[self dismissModalViewControllerAnimated:YES];
NSLog(@"Group Name: %@", txtGroupName.text);
NSMutableArray *newDict = [[NSMutableArray alloc] init];
[self.groups setObject:newDict forKey:txtGroupName.text];
NSLog(@"Count:%d", [self.groups count]);
BOOL success = [self.groups writeToFile:self.groupPath atomically:YES];
if(success) {
NSLog(@"Success Saving New Group");
} else {
NSLog(@"Failure Saving New Group");
}
[newDict release];
}
}
Here is what the debug shows:
2010-07-01 00:48:38.586 Contacts[7111:207] Done
2010-07-01 00:48:38.589 Contacts[7111:207] Group Name: C
2010-07-01 00:48:38.590 Contacts[7111:207] Count:3
2010-07-01 00:48:38.592 Contacts[7111:207] Success Saving New Group
However, when I open the .plist file, it still has only 2 groups that I had created manually, and not the new entry.
The files are located in my ~Documents folder.
Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…