Got a Stumper (at least for me).
I am using iOS 5.0 w/ ARC, and Core Data inside of UIManagedDocument.
I have an Entity (Group) with a to-many relationship (called people) to entity (Person). When I add a new Group, and add then a new Person (setting the person's .group relationship to the new group), I cannot retrieve the related people using a predicate on the Person entity where ("group == %@", myGroup). I also tried using the Group's addPerson setter.
If I shut down XCode simulator and rerun it, it recognizes the relationship that was created in the previous run, I can even add new people to the existing Group object. I just can't add a new Group and then add people to without shutting down the Simulator (or device if I'm running on device) in order to see the relationship.
If I do a [group.people count], immediately after adding the new Group and a related Person, it gives me the correct number. But a fetch with a predicate doesn't work until I restart the app.
It seems as if the managedObjectContext of the UIManagedDocument is not seeing the relationship. I've tried saving the context, saving context.parentContext, and saving the Document. None of that helped.
Any ideas would be appreciated!