creating managed objects using code in xcode & core-data
Posted
by themadpeacock
on Stack Overflow
See other posts from Stack Overflow
or by themadpeacock
Published on 2010-04-14T01:27:18Z
Indexed on
2010/04/14
1:33 UTC
Read the original article
Hit count: 389
New to objective-c xcode and core-data so sorry for the remedial question.
I have set up a very simple data model:
Entity1 and Entity2, both contain a single attribute (String) and a one-to-many relationship with the other.
I want to scan Entity1 and depending on the results of the scan create one or more Entity2 objects that link to Entity1.
How can I do this? I don’t understand how I create Entity2 type objects in code and how I would define the relationship to the Entity1 object they are related to.
I come from a SQL programming background where inserting elements into the Entity2 table with the ID of the related Entiry1 entry is easy. I can’t get my head around the xcode core-data abstraction and would appreciate any help.
© Stack Overflow or respective owner