Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 493
coder Avatar asked Jul 29 '13 14:07

coder


1 Answers

have you tried

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

?

like image 79
Francesco Avatar answered Sep 28 '22 02:09

Francesco