Adding to-many objects programmatically
Adding to-many objects programmatically
- Subject: Adding to-many objects programmatically
- From: Jenny M <email@hidden>
- Date: Fri, 15 Jan 2010 20:52:29 -0800
Hi all,
I need to add a set of default objects to my core data store when the
application is launched for the first time. (I store the properties for
these objects in the app's plist.) The two objects (Types and Categories)
are both to-many relationships - one type has many categories, and one
category can appear in multiple types. I can read the plist and create each
object just fine, but I don't have any idea how to add the objects to the
other's relationship. I tried to add the objects one-by-one and it said it
wanted an NSSet. Here's my flow, but I don't know about the code...
1. Create all Categories objects
-- while creating a category, add object to a NSMutableSet
2. Create all Type objects
-- when creating object, use setValue forKey to set the relationship to the
NSMutableSet
I haven't gotten this to work yet. Does this sound like I'm on the right
path, or am I doing too much work? Is there a different way to
programmatically insert default many-to-many objects?
Thanks...
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden