I’m using the RubyCocoa framework (well, trying to), freshly compiled
today (oops, yesterday) from the svn stable repository.
I want my application controller to get asynchronous notifications
when a file descriptor has new data to be read, so I decided to use
OS X infrastructure.
Here is the interesting part of the code:
class Controller < OSX::NSObject
addRubyMethod_withType(‘dataAvailable:’, ‘[email protected]:@’)
# do something
Of course setup_data_available_notification and
setup_notification_observer are called by awakeFromNib.
Everything should be right, but when the default center tries to send
my Controller a message I get logged:
2006-11-03 00:46:37.262 Fango Exception raised during posting
of notification. Ignored. exception: *** -[NSProxy
It looks like it can find the method signature (provided by
addRubyMethod_withType), but the forwardInvocation: method of the
Objective-C wrapper to my ruby Controller class doesn’t actually call
my ruby method. In fact, this makes me suppose forwardInvocation:
isn’t overrided at all and the message is catched by the parent class
which raises an exception, but I haven’t read RubyCocoa source code
so I can’t be sure.
I followed closely what’s written here: http://www.rubycocoa.com/
appleremote/2 . I double checked Apple documentation of
I also searched on google for other documentation about selectors and
RubyCocoa, but all I could get was code with japanese comments which
didn’t use addRubyMethod_withType at all. I guess that code was for
another version of RubyCocoa (newer, maybe? From the unstable
This is what I tried:
- removing addRubyMethod_withType
- adding ns_override
- using :dataAvailable_, :dataAvailable, ‘dataAvailable’ instead of
- defining the method dataAvailable_ instead of dataAvailable
- something else I can’t remember
Most of which I didn’t expect to actually work, but decided to try
anyway. Some bugs just make you paranoid.
I’m using Mac OS X 10.4.8 (PPC), XCode 2.4.
Thanks in advance!