In my iPad application, I am using Multithreading to read data from my database and hence I am using different manged object contexts as explained Fred McCann's blog
The problem I am facing is while deleting items from the data开发者_运维问答base. When I try to delete, I get the error that the managedObjectContext cannot delete another objectContext's data. How do I solve this problem?
It would be great is someone could help me out with this.
You need to pass the objectId
s around and then get that object from the other context.
NSManagedObject *object = // get the object...
NSManagedObjectID *objectID = object.objectID;
// Pass to other context on other thread...
// ...
NSManagedObject *sameObjectDifferentContext = [managedObjectContext objectWithID:objectID]
精彩评论