plist에 부울 값을 쓰는 것에 대한 질문이 있습니다. 유선은 쓰기 전에 plist에 대한 dir이고 읽기는 완전히 동일하지만, 그 값에 부울 값을 쓸 수는 없습니다. 이 문제를 어떻게 해결할 수 있습니까? btw : iPhone 시뮬레이터에서 결과를 얻었지만 실제 iPhone 디버그에는 실패했습니다.plist에 boolean 파일 쓰기에 대해
//--- CODE HERE ---//
[ContentList objectAtIndex: paramSender.tag] setValue: [NSNumber numberWithBool: TRUE] forKey: BooleanKey]; // set object boolean value to be ture;
[ContentList writeToFile: self.plistPath atomically: YES]; // update the plist
NSMutableArray *tmp = [[NSMutableArray alloc] initWithContentsOfFile: self.plistPath]; // get the content from the updated plist
NSLog(@"the bool value is %@", [[ContentList objectAtIndex: paramSender.tag] objectForKey: BooleanKey]);
NSLog(@"After update boolValue is %@", [[tmp objectAtIndex: paramSender.tag] objectForKey: BooleanKey]);
//--- OUTPUT IN NSLOG ---//
2012-04-23 18:09:12.164 iPhoneTips[151:707] the bool value is 1
2012-04-23 18:09:12.167 iPhoneTips[151:707] After update boolValue is 0
//--- FINISH ---//
아니요, 여전히 진짜 아이폰. – DavidBear
왜 시뮬레이터와 실제 iPhone에서 결과가 다른지 궁금합니다. – DavidBear