Re: Good way to have default relationship to override nil?
Re: Good way to have default relationship to override nil?
- Subject: Re: Good way to have default relationship to override nil?
- From: Jim Thomason <email@hidden>
- Date: Wed, 20 Aug 2014 16:48:34 -0500
>
> > I have a set of relationships:
> >
> > Foo.proxy <----> Foo.proxyFor
>
> That’s a head-scratcher, Jim. A relationship is not between properties.
> A relationship is between objects,
>
> Foo <——> Bar
>
> In some cases, probably yours, the objects may be of the same type…
>
> Foo <—> Foo
>
I apologize, I was merely not being clear -
Yes, the relationship is between two Foo objects, with the relevant
properties being proxy and proxyFor.
> Now on to the real issue…
>
> > [someFooObj setProxy:otherFooObj] ;
> >
> > All hell breaks loose
> >
> > I finally fixed this by -not- overriding the Core Data setter
>
> You didn’t post your override of -setProxy:. Post that override, and
> maybe someone can answer your questions.
That was a typo (Man, I'm being horribly unclear today...). I meant that I
fixed it by -not- overriding the CoreData getter.
That is, I didn't use the -(Foo*) proxy; method I posted originally, and
instead changed it to using -(Foo*) defaultProxy, and left the proxy getter
as @dynamic.
I have the same issue whether I use a custom setProxy:(Foo*) method or the
default @dynamic'ally generated one - the didChangeValueForKey:@"proxy"
note causes that cascade of setting to nil, and then to self.
Only by moving that functionality out of the proxy getter and into the new
defaultProxy getter did I resolve it.
(technically, I could also resolve it by overriding setProxy: and not
calling willChangeValueForKey:/didChangeValueForKey:, but of course, that's
not the right solution)
-Jim.....
_______________________________________________
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