In the application that I am writing I am trying to write a list of fortunes for a fortune cookie out to a property list. In the simulator this works as expected and everything is great. On the iPod Touch I have it reads from said list fine but it never updates the list.
Are there any differences between updating property lists using the simulator and using the 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];
}