Re: Cant Access Properties of NSManagedObject from a NSArrayController...
Re: Cant Access Properties of NSManagedObject from a NSArrayController...
- Subject: Re: Cant Access Properties of NSManagedObject from a NSArrayController...
- From: Quincey Morris <email@hidden>
- Date: Tue, 24 Nov 2009 11:58:48 -0800
On Nov 24, 2009, at 11:42, Gustavo Pizano wrote:
> Now the interesting part, 14, I did jsut a test to see what I could get, and eventually the way it is, I get the value of @"ico", BUT, If I try to do the follwoing: NSLog(@"%@",[(User *)[[parent _userListArrayController] selection] ico]);, then I get:
>
> -[_NSControllerObjectProxy ico]: unrecognized selector sent to instance 0x100266580
> so in 15 when I try to add this newInvoice to the existing ones, with the addToInvoicesObject method, I get also something like this :
>
> -[_NSControllerObjectProxy addToInvoicesObject:]: unrecognized selector sent to instance 0x1001b7a10
>
> so at the end I can't add an invoice to the selected user from the _userListArrayController..
>
> any clue what Im doing wrong?
You should read the documentation for the 'selection' method (in NSObjectController, the superclass of NSArrayController).
That method gives you a *proxy* object that you can use for KVC access to the underlying properties (as you found) but doesn't respond to specific accessors (as you found).
If you want the actual data model objects (that is, the NSManagedObject [or subclass] objects), use the NSArrayController's 'selectedObjects' method instead -- which always returns an array, BTW, so just use the object at index 0.
_______________________________________________
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