• 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: keyPathsForValuesAffectingValueFor<key>: not updating immediately
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: keyPathsForValuesAffectingValueFor<key>: not updating immediately


  • Subject: Re: keyPathsForValuesAffectingValueFor<key>: not updating immediately
  • From: Jim Correia <email@hidden>
  • Date: Tue, 27 Oct 2009 11:59:27 -0400

On Tue, Oct 27, 2009 at 11:39 AM, Brad Gibbs <email@hidden> wrote:

> I don't think there's anything wrong with the method -- I've used it
> successfully in other apps and have seen it work in Apple sample apps, it
> just isn't working in this particular case.  I'm sure that there's something
> wrong on my end.  Just looking for a little help in figuring out what that
> could be...

We are at the point where we can't offer useful advice without seeing
your code. Since +keyPathsForValuesAffecting<Key> is not fundamentally
broken, the most likely cause is a problem with your code.

> - (NSSet *)keyPathsForValuesAffectingValueForFullAddress {
>        return [NSSet setWithObjects:self.streetAddress, self.city,
> self.state, self.zipCode, nil];
> }

This is wrong for 2 reasons.

Reason #1 - see below.

Reason #2 - you should be passing the literal key paths which affect
the value, not self.streetAddress which is the current value of that
key path.

> I've also tried:
>
> - (NSSet *)keyPathsForValuesAffectingValueForFullAddress {
>        return [NSSet setWithObjects:@"streetAddress", @"city", @"state",
> @"zipCode", nil];
> }

+keyPathsForValuesAffecting<Key> should be implemented as a class
method. (That's what the + prefix means.) You've implemented it as an
instance method. Change it to a class method and you should find that
it works correctly.

(If you set a breakpoint on your code as written, you'll find that it
is never called, which should be a warning sign to you that something
is wrong.)

- 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: keyPathsForValuesAffectingValueFor<key>: not updating immediately
      • From: Brad Gibbs <email@hidden>
References: 
 >keyPathsForValuesAffectingValueFor<key>: not updating immediately (From: Brad Gibbs <email@hidden>)
 >Re: keyPathsForValuesAffectingValueFor<key>: not updating immediately (From: "I. Savant" <email@hidden>)
 >Re: keyPathsForValuesAffectingValueFor<key>: not updating immediately (From: Brad Gibbs <email@hidden>)
 >Re: keyPathsForValuesAffectingValueFor<key>: not updating immediately (From: Jim Correia <email@hidden>)
 >Re: keyPathsForValuesAffectingValueFor<key>: not updating immediately (From: Brad Gibbs <email@hidden>)

  • Prev by Date: Re: Alternative to stringWithContentsOfURL
  • Next by Date: programmatically determining whether a system would run a GC only app
  • Previous by thread: Re: keyPathsForValuesAffectingValueFor<key>: not updating immediately
  • Next by thread: Re: keyPathsForValuesAffectingValueFor<key>: not updating immediately
  • Index(es):
    • Date
    • Thread