Core Data: mutableArrayValueForKey and addObject
Core Data: mutableArrayValueForKey and addObject
- Subject: Core Data: mutableArrayValueForKey and addObject
- From: Luc Vandal <email@hidden>
- Date: Tue, 03 Feb 2009 21:29:58 -0500
Hi,
A1 = customers array with a to-many relationship to invoices
A2 = invoices array with a relationship to customers
Bindings set in IB as Content Set -> Customers.selection.invoices with
invoices as the model key path.
I understand that calling addObject directly is a KVO no-no and that I
need to get a NSMutableArray from my array controller and alter it.
But how do I know what key is related to the array? I tried calling:
NSMutableArray *a = [invoiceArrayController
mutableArrayValueForKey:@"invoices"];
but I get this error:
[<NSArrayController 0x144b00> valueForUndefinedKey:]: this class is
not key value coding-compliant for the key invoices.
Also tried:
NSMutableArray *a = [invoiceArrayController
mutableArrayValueForKeyPath:@"Customers.selection.invoices"]; with no
success.
In the documentation, it says that 'key' is the name of an ordered to-
many relationship.
I did find documentation about this but it's lacking examples and I'm
confused. Could anyone explain or direct me to an example? It seems
that this is a common trap when starting to work with Core Data but
I've yet to find something clear to figure this out!
Thanks!
Luc
_______________________________________________
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