From: Rich W. <rw...@gm...> - 2008-01-01 03:52:52
|
I thought I'd read that RubyCocoa supported Key Value Observing; however, I can't get the following to work: require 'osx/cocoa' OSX.require_framework 'CoreData' class AppDelegate < OSX::NSObject def awakeFromNib() @posts.addObserver_forKeyPath_options_context_(self, "content", 0, nil) end def observeValueForKeyPath_ofObject_change_context_(key_path, object, change, context) set_html() if object == @posts end ... end When I run this code, I get the following error: /Users/rikiwarren/Develop/Ruby/Test/build/Release/Test.app/Contents/ Resources/rb_main.rb:22:in `NSApplicationMain': Ruby object `#<AppDelegate:0xe3c90c class='AppDelegate' id=0x26dbbe0>' doesn't respond to the ObjC selector `observeValueForKeyPath:ofObject:change:context:', the method either doesn't exist or is private (RuntimeError) from /Users/rikiwarren/Develop/Ruby/Test/build/Release/ ArticleSandbox.app/Contents/Resources/rb_main.rb:22 Bindings seems to work fine, and I know that uses KVO heavily. Any idea what I'm doing wrong here? -Rich- |