• 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
Weird KVO problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Weird KVO problem


  • Subject: Weird KVO problem
  • From: "Mike R. Manzano" <email@hidden>
  • Date: Sun, 25 Nov 2007 00:29:22 -0800

Sorry for all the KVC/KVO/KVB postings lately, but I'm finding it hard to understand their behavior. Here is my latest problem (don't even ask me how I got here; most of this code is the result of a desperate attempt to figure all this out):

- (void) ping
	{
	NSLog( @"selection:%@", [_blogAccountsController
		valueForKeyPath:@"selection.serviceURL"] ) ;
	}

- (void) awakeFromNib
	{
	[_blogAccountsController addObserver:self
		forKeyPath:@"selection.serviceURL"
		options:0 context:nil] ;

//	observeValueForKeyPath:ofObject:change:context: is only ever called
//	if the following two lines are uncommented.
//	[self	performSelector:@selector(ping)
//		withObject:nil afterDelay:0] ;

	}


- (void)observeValueForKeyPath:(NSString *)keyPath
ofObject:(id)object
change:(NSDictionary *)change
context:(void *)context
{
NSLog( @"attr at keyPath changed: %@ on object: %@" , keyPath , object ) ;
}


_blogAccountsController is an NSArrayController bound to a Core Data context to an entity named "blog" which in turn contains a serviceURL attribute.

Without the performSelector:withObject:afterDelay: message in - awakeFromNib, my observeValueForKeyPath is never called. However, if I uncomment those lines, observeValueForKeyPath is called just fine.

What's going on here?

Thanks,

Mike

_______________________________________________

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


  • Prev by Date: Re: How to get window title bar font ^size^ ?
  • Next by Date: Re: Preference pane deployment
  • Previous by thread: Re: How to get window title bar font ^size^ ?
  • Next by thread: Developer for SOAP
  • Index(es):
    • Date
    • Thread