我有一個向plist寫入布爾值的問題。 有線的東西是寫入和讀取之前plist的目錄是完全相同的,但我不能寫入它的布爾值。我怎麼解決這個問題? 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 ---//
不,結果仍然相同真正的iphone。 – DavidBear 2012-04-23 09:29:21
我想知道爲什麼在模擬器和真正的iPhone – DavidBear 2012-04-23 09:29:54