How to obtain relationship data?
I have some a couple of entities. One is used for the actual product information. The second one is for the information regarding certain documentation (in this case some PDF files). I am trying to pull the data of both the product and it's corresponding data in the document entity. Not all products have documents connected to them, so in a way I am trying to d开发者_Python百科o what would be a join in a relational database.
I also have declared relationships for both entities. I am relatively new using Core Data. I can fetch the data for the individual entities, but can't seem to have the same success for the relationships.
Does anyone know of a good tutorial, or can point me in the right direction to fetch the information only relevant to the relationship?
When setting up an NSFetchRequest
, you can pass an NSArray
of keys for the relationship you want to fetch using -setRelationshipKeyPathsForPrefetching:
精彩评论