• 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
Multiple Observations
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multiple Observations


  • Subject: Multiple Observations
  • From: Gordon Apple <email@hidden>
  • Date: Fri, 14 Jun 2013 15:06:07 -0500
  • Thread-topic: Multiple Observations

- (void)awakeFromNib {
    [self.doc addObserver:self
               forKeyPath:@"currentPath"
                  options:NSKeyValueObservingOptionNew |
NSKeyValueObservingOptionOld
                  context:nil];
}

- (void)observeValueForKeyPath:(NSString *)keyPath
                      ofObject:(id)object
                        change:(NSDictionary *)change
                       context:(void *)context  {

    if (object == self.doc && [keyPath isEqualToString:@"currentPath"] &&
self.outlineView != nil) {
        [self.outlineView reloadData];

        //    Debugging
        static NSUInteger dingCount = 0;
        dingCount++;
        NSLog(@"dingCount = %lu", dingCount);
    }
}

³currentPath² property in doc gets set once.  Observation gets dinged about
200 times.  Removing the ³reloadData² didn¹t affect this.  Same observer in
another file gets dinged once, like it should.  Stack trace always leads
back to where "currentPath" is set in doc.  Any theories on what could cause
this observer to have diarrhea?
_______________________________________________

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: Multiple Observations
      • From: Lee Ann Rucker <email@hidden>
    • Re: Multiple Observations
      • From: Quincey Morris <email@hidden>
  • Prev by Date: Re: Isolated process for each NSDocument of my app
  • Next by Date: Re: Multiple Observations
  • Previous by thread: Re: -[NSManagedObjectContext performBlock:] concurrent or serial?
  • Next by thread: Re: Multiple Observations
  • Index(es):
    • Date
    • Thread