iPhone - Create non-persistent entities in core data
- by ncohen
Hi everyone,
I would like to use entity objects but not store them... I read that I could create them like this:
myElement = (Element *)[NSEntityDescription insertNewObjectForEntityForName:@"Element" inManagedObjectContext:managedObjectContext];
And right after that remove them:
[managedObjectContext deleteObject:myElement];
then I can use my elements:
myElement.property1 = @"Hello";
This works pretty well even though I think this is probably not the most optimal way to do it...
Then I try to use it in my UITableView... the problem is that the object get released after the initialization. My table becomes empty when I move it!
Thanks
edit: I've also tried to copy the element ([myElement copy]) but I get an error...