Namaste!

After having done many hours of investigating, head-scratching, trial/ error, and more searching, I've gotten stuck.

I created a simple scenario to work out how to accomplish a many-to- many situation. I created two entities: Person and Hat. They are defined thus:

Person:
personName: string
relHats: to-many relationship to Hat

Hat:
hatName: string
relPersons: to-many relationship to Person

The relationships are inverses.

I dragged three Array Controllers to the MainMenu.NIB: Persons, Hats, and Persons_Hat.

Persons and Hats are bound to their respective entities.

Persons_Hats is bound thus:

contentSet:  Persons.selection.relHats
contentArrayForMultipleSelection:  Persons.selection.relHats

I dragged a tableview onto the window to support add/remove of Persons. One column, value bound to Persons.arrangedObjects.personName.

I dragged two buttons, bound them to add/remove of Persons respectively.

I dragged another tableview onto the window to support add/remove of Persons_Hats. One column, containing a popup. The column is bound thus:

Content:  Hat.arrangedObjects
ContentValues:  Hat.arrangedObjects.hatName
SelectedValue:  Persons_Hats.arrangedObjects.relHats

I dragged two more buttons on to support add/remove of Persons_Hats. Bound appropriately.

I dragged one more button to support Add for Hat.  Bound appropriately.

Running the application generates the following error:

2008-11-29 11:29:34.876 TestManyToMany2[2820:10b] Unacceptable type of value in to-many relationship: property = "relHats"; problem = {( <NSManagedObject: 0x1b4ea0> (entity: Person; id: 0x18ac80 <x-coredata:///Person/tFF2FA03C-6F69-49C3-9190-FB99E9DC1DCC4 > ; data: {
    personName = "New Person";
    relHats =     (
    );
})
)}; desired type = NSManagedObject_Hat_; given type = NSCFSet; value = <NSManagedObject: 0x1b4ea0> (entity: Person; id: 0x18ac80 <x-coredata:///Person/tFF2FA03C-6F69-49C3-9190-FB99E9DC1DCC4 > ; data: {
    personName = "New Person";
    relHats =     (
    );
}).

I don't know what to do with that.

I compared what I have with the sample application, Event Manager, and what I have appears to correspond with the way that application is set up. The main difference being that EventParticipant (which corresponds with Persons.relHats in my sample) is a separate table.

I did try this as a flatter relationship (a "key" table between), but I was getting the same result. Something I know is not quite right as the EventManager app works just fine.

I haven't been able to resolve this problem, which is very key to getting my actual (I'm porting an existing Windows VB .NET/WPF app over) application to work.

Theoretically, from my vantage, this should function.

Anyone care to help out on this one? If this simply can't be done, just tell me so I don't waste any more time on it and I'll go another route.

Yes, I've read the dox, read the Hillegass book, and spent many hours trolling through post after post.

I'm sure it is something really stupid, but I just don't see it.

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to