I tried converting a working script rubycocoa script to macruby and it failed on this line...
NSDistributedNotificationCenter.defaultCenter.addObserver_selector_name_object(self, :next_number, "next number", "com.imasender") #Working RubyCocoa line NSDistributedNotificationCenter.defaultCenter.addObserver self, selector: :next_number, name: "next number", object: "com.imasender" #But gives the error below when converted to MacRuby grammer and run with macruby. 2008-12-11 21:45:43.448 macruby[66187:10b] *** -[Receiver next_number]: unrecognized selector sent to instance 0x1319720 receiver.rb:29:in `run': NSInvalidArgumentException: *** -[Receiver next_number]: unrecognized selector sent to instance 0x1319720 (RuntimeError) from receiver.rb:29:in `<main>' It's driving me crazy. If the statement is a correct translation from RubyCocoa to MacRuby syntax why am I getting a "unrecognized selector sent to..." error?
Hi,
NSDistributedNotificationCenter.defaultCenter.addObserver self, selector: :next_number, name: "next number", object: "com.imasender" #But gives the error below when converted to MacRuby grammer and run with macruby.
It's driving me crazy. If the statement is a correct translation from RubyCocoa to MacRuby syntax why am I getting a "unrecognized selector sent to..." error?
I think your selector should not be :next_number but 'next_number:' (note the ':' at the end). Every method that has a parameter should have its selector ending with a ':' in MacRuby. Cheers, Vincent
participants (2)
-
Tim Rand
-
Vincent Isambart