Retrieve NSManagedObjectContext from NSManagedObject
Asked Answered
T

1

6

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?

Transmittance answered 29/7, 2013 at 14:30 Comment(0)
T
18

have you tried

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

?

Tother answered 29/7, 2013 at 14:38 Comment(2)
you're welcome! The obvious solution is always the most difficult to find :pTother
lol, Thanks! me two ! .I can't believe I didn't find that before. thanksRhodolite

© 2022 - 2024 — McMap. All rights reserved.