> On May 10, 2016, at 4:13 PM, Quincey Morris > <quinceymor...@rivergatesoftware.com> wrote: > > On May 10, 2016, at 16:05 , Carl Hoefs <newsli...@autonomy.caltech.edu > <mailto:newsli...@autonomy.caltech.edu>> wrote: >> >> I'm not sure how context is to be used here > > It has to be a value that’s unique to the piece of code that tests it. In > effect, this means unique to the class that creates and responds to the > observations. If you’re in Obj-C, the usual trick is to use the static > address of something, like this: > >> static void* kvoContext = &kvoContext; > > This exploits a quirk of C to initialize the static variable as containing > its own address. That means you can specify the ‘context:’ parameter as > EITHER ‘kvoContext’ OR ‘&kvoContext’, so that forgetting the & is harmless. > > Okay... It appears that for some odd reason, once in a blue moon, 'object' and 'keyPath' aren't what they're supposed to be, so I super it, and it blows.
- (void) observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ((object == uploadQueue) && [keyPath isEqualToString:@"operations"]) { [self performSelectorOnMainThread:@selector(displayQueueInfo) withObject:nil waitUntilDone:NO]; } else { [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; } } I will set 'context' and use it in my check instead. -Carl _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com