내 writeToFile이 내 데이터를 내 .plist에 저장하지 않습니다. 여기iphone - writeToFile 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];
}
}
디버그 보여줍니다 것입니다 그러나
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
, 나는 .plist 파일을 열 때, 그것은 여전히 새 항목을 내가 직접 만들었다 단지 2 그룹이 아닌.
파일은 내 ~ 문서 폴더에 있습니다.
아이디어가 있으십니까?
그룹 경로 란 무엇입니까? 인쇄 할 수 있습니까? – vodkhang
NSString * 경로 = [[NSBundle mainBundle] pathForResource : @ "그룹"ofType : @ "plist"]; self.groupPath = path; – john
글쓰기 :/Users/Me/Library/Applications 지원/iPhone Simulator/4.0/Applications /.../ Groups.plist .plist에 저장할 수있는 방법이 있나요? 내 작업 공간? – john