coder
coder

Reputation: 10520

Retrieve NSManagedObjectContext from NSManagedObject

I've looked for this solution for a while, and I've always given up and found a work around, but does anyone know how do find the NSManagedObjectContext from an instance of an NSManagedObject?

I am currently using 3 contexts, and I would like to retrieve which context an instance of an object is in. Does anyone know a way to do this?

Upvotes: 6

Views: 2235

Answers (1)

Francesco
Francesco

Reputation: 1848

have you tried

NSManagedObject *myObj; //reference in some way
NSManagedObjectContext *objContext = [myObj managedObjectContext];

?

Upvotes: 18

Related Questions