简体   繁体   中英

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 do 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?

设置NSFetchRequest ,可以使用-setRelationshipKeyPathsForPrefetching:为要获取的关系传递键的NSArray -setRelationshipKeyPathsForPrefetching:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM