Hi all,
In my application I need to cache the data that's being parsed for which I'm using coredata and inserting it in managedobjectcontext on a thread which is performing the xml parsing function. So this thread is performing two things: parsing and inserting in coredata.
I'm using the following function:
-(void)saveData
{
self.managedObjectContext = appDelegate.managedObjectContext;
if(anEvent)
{
//Create an object
Event * newEvent = (Event *)[NSEntityDescription
insertNewObjectForEntityForName:@"Event"
inManagedObjectContext:self.managedObjectContext];
// Step 2: Set Properties
[newEvent setId:anEvent.id];
[newEvent setEletitle:[NSString stringWithFormat:@"%@", anEvent.eletitle]];
[newEvent setSortId:(NSInteger)sortId +1];
[newEvent setEletxt:[NSString stringWithFormat:@"%@", anEvent.eletxt]];
// Step 3: Save Object
[self saveAction];
}
}
The problem I'm facing is anEvent object containing the values, they are not getting inserted in newEvent. After inserting any property, when I check the property in newEvent then I see the property type gets converted into "NSTemporaryObjectId_Default".
All my coredata initialisations are in appDelegate and I'm borrowing the context in a new class.
Can anybody please help?
Thanx in advance.