在MacRuby中调用objective-c方法时出现NoMethodError



我试图从MacRuby应用程序调用objective-c方法,只要我在方法中只有一个变量,它就可以正常工作。如果我添加第二个变量,我得到一个NoMethodError。

我有一种感觉,这是件小事,但我似乎不明白。

这是有效的方法:

- (int)testMethod:(int) x

而这个没有

- (int)testMethod:(int) x secondVariable:(int)y

当我通过MacRuby testClass.testMethod(1)调用第一个方法时,一切都运行良好,但当我调用第二个方法时,我得到:in test_command': undefined method testMethod' for:testClass (NoMethodError)

最新MacRuby中第二个方法的语法应该如下:

testClass.testMethod(x, secondVariable:y)

相关内容

最新更新