• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Good way to have default relationship to override nil?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Good way to have default relationship to override nil?
      • From: Jerry Krinock <email@hidden>
References: 
 >Good way to have default relationship to override nil? (From: Jim Thomason <email@hidden>)
 >Re: Good way to have default relationship to override nil? (From: Jerry Krinock <email@hidden>)

  • Prev by Date: Re: Issuing NSTextField action message
  • Next by Date: memmove in Swift
  • Previous by thread: Re: Good way to have default relationship to override nil?
  • Next by thread: Re: Good way to have default relationship to override nil?
  • Index(es):
    • Date
    • Thread