Re: Adding to-many objects programmatically

2010-01-16 Thread mmalc Crawford
On Jan 16, 2010, at 12:17 am, Roland King wrote: > Cast to the actual type before calling the method. > Instead of [ managedObject method1 ] > do > [ (Employee*)managedObject method1 ] > No; the OP stated, "I don't use custom classes", so this won't work. Follow the pattern described in the docu

Re: Adding to-many objects programmatically

2010-01-16 Thread Roland King
Cast to the actual type before calling the method. Instead of [ managedObject method1 ] do [ (Employee*)managedObject method1 ] On 16-Jan-2010, at 14:57, Jenny M wrote: When I tried to use the getter/setter, I get a build warning that says the NSManagedObject may not respond to that metho

Re: Adding to-many objects programmatically

2010-01-15 Thread mmalc Crawford
On Jan 15, 2010, at 10:57 pm, Jenny M wrote: > The objects do load, I ran the program regardless of warnings and it > did set the categories and references. So, how would I get it to build > without those warnings? > All of this is covered in the documentation:

Re: Adding to-many objects programmatically

2010-01-15 Thread Jenny M
When I tried to use the getter/setter, I get a build warning that says the NSManagedObject may not respond to that method. I noticed in the documentation, they're referring to the entities themselves - Employee and Department. I don't use custom classes, just the data model, so I've been referring

Re: Adding to-many objects programmatically

2010-01-15 Thread mmalc Crawford
On Jan 15, 2010, at 10:00 pm, Jenny M wrote: > I guess my question is also, was there any easier way to do it?? Is that how > it's normally done? > It's not clear exactly what you're referring to. Do you mean, is the typical pattern that which you described earlier, namely: > I've been setting

Re: Adding to-many objects programmatically

2010-01-15 Thread Jenny M
I've been setting it using key-value coding: [object setValue:mySet forKey:categories] so far, so that's good to know I'm on the right track. Though at the moment I am apparently having difficulties comparing strings, because I can't get my log messages to appear in the console hmm. Okay, duh,

Re: Adding to-many objects programmatically

2010-01-15 Thread mmalc Crawford
On Jan 15, 2010, at 8:52 pm, Jenny M wrote: > but I don't know about the code... > Modifying to-many relationships is described here: What did you t

Adding to-many objects programmatically

2010-01-15 Thread Jenny M
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 cat