CoreData获取孩子的父母 [英] CoreData get parent of child

查看:62
本文介绍了CoreData获取孩子的父母的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个一对多关系 store< ---->>产品,并且我知道该产品,那么我如何找出该产品的父级是谁?我可以有许多具有相同值的产品,例如 product1 具有 parent1 和另一种具有与 product1 具有 parent2 ,因此我无法搜索哪个父项包含 product1

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?

推荐答案

您应该已经注意到核心数据模型编辑器在困扰您有关该关系没有反向关系(如果您没有)。如果确实有一个,则就像使用该键一样简单。

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.

假设地,商店的关系为产品-因此,每个产品都应具有 store 的关系。

Hypothetically, store has a relationship products - so each product should have a relationship store.

这篇关于CoreData获取孩子的父母的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆