问题
I have a one-to-many
relationship store <---->> product
, and I know the product, how can I find out who the parent of this product is? I can have many products with the same values, for example product1
has parent1
and another product with the same values as product1
has parent2
so i cant't search which parent contains product1
?
回答1:
You should have noticed the core data model editor bugging you about the relationship not having an inverse relationship if you don't have one. If you do have one, it's as simple as using that key.
Hypothetically, store
has a relationship products
- so each product
should have a relationship store
.
来源:https://stackoverflow.com/questions/23923673/coredata-get-parent-of-child