• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Adding to-many objects programmatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Adding to-many objects programmatically
      • From: Jenny M <email@hidden>
    • Re: Adding to-many objects programmatically
      • From: mmalc Crawford <email@hidden>
  • Prev by Date: needing help w/ asynchronous message problem, using YAMessageQueue
  • Next by Date: Re: Adding to-many objects programmatically
  • Previous by thread: Re: How to show progress indicator for background job
  • Next by thread: Re: Adding to-many objects programmatically
  • Index(es):
    • Date
    • Thread