iPhone - Create non-persistent entities in core data

Posted by ncohen on Stack Overflow See other posts from Stack Overflow or by ncohen
Published on 2010-04-22T19:22:16Z Indexed on 2010/04/22 22:13 UTC
Read the original article Hit count: 233

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...

© Stack Overflow or respective owner

Related posts about iphone

Related posts about core-data