MagicalRecord relationship mapping duplicates objects despite primary keys

前端 未结 1 2052
余生分开走
余生分开走 2021-02-10 00:35

I\'m in need of some assistance for an issue I am experiencing with MagicalRecord data importing. I was under the impression that MagicalRecord was able to handle relationship m

1条回答
  •  独厮守ぢ
    2021-02-10 01:11

    I managed to solve this a while back.

    What I did was add relatedByAttribute in the User Info dictionary for the children relationship AND for the Child entity as well.

    So click on the relationship and set relatedByAttribute to childId (in my example above) and also click on the Child entity on the left and for this also set relatedByAttribute to childId in the User Info dictionary for the entity itself.

    This allows Magical Record to correctly map using existing objects or create new ones if needed - granted that the ID attribute is 100% unique!

    enter image description here

    0 讨论(0)
提交回复
热议问题