私が書いているアプリケーションでは、フォーチュン クッキーのフォーチュンのリストをプロパティ リストに書き込もうとしています。シミュレーターでは、これは期待どおりに機能し、すべてが優れています。iPod Touchでは、上記のリストから正常に読み取りますが、リストを更新することはありません。
シミュレーターを使用してプロパティ リストを更新する場合と、iPod Touch を使用する場合に違いはありますか?
if(indexEdit == [data count])
{
NSString *temp = [NSString stringWithFormat:@"%@", textField.text];
[self.data addObject:temp];
}
else
{
NSString *temp = [NSString stringWithFormat:@"%@", textField.text];
[data replaceObjectAtIndex:indexEdit withObject:temp];
}
NSString *errorDesc;
NSString *bundlePath = [[NSBundle mainBundle] pathForResource:@"Fortunes" ofType:@"plist"];
NSData *plistData = [NSPropertyListSerialization dataFromPropertyList:data format:NSPropertyListXMLFormat_v1_0 errorDescription:&errorDesc];
if (plistData)
{
[plistData writeToFile:bundlePath atomically:YES];
}
else
{
NSLog(errorDesc);
[errorDesc release];
}