Reputation: 2413
This is probably a really simple question. I have a bunch of stuff in a sql lite db. I can retrieve that stuff and store it to an array just fine. When i iterate through that array with a for (MyCustomMo *mo in myDataArray)
i can access the managed objects attributes just fine with e.g. mo.name.
So far everything is working ok, but...
Later when i get an object from that same array with [myDataArray objectAtIndex:index]
i get a MyCustomMo* but when i try to access the attributes of that object i get null. Do i need to use [myDataArray objectAtIndex]
somehow differently?
Upvotes: 1
Views: 2480
Reputation: 2413
Okay, i got it. The reason it wasn't working was 'cause i was using a local ManagedObjectContext in viewDidLoad. I didn't come to think that ManagedObject needs the ManagedObjectContext when it lazily loads attributes.
Upvotes: 5