[MacRuby-devel] Calling ObjC method

Satoshi Nakagawa snakagawa at infoteria.co.jp
Tue Mar 4 19:43:48 PST 2008


Hi,

I tried to call a method in my ObjC class, then I got the 'private  
method' error.
Even with a bridge-support file for the class, it remains the same.

How can I use my ObjC class?

@interface TestObject : NSObject
- (void)test;
@end

#dir = NSBundle.mainBundle.resourcePath.fileSystemRepresentation
#load_bridge_support_file dir + '/TestObject.bridgesupport'

class AppController < NSObject
   def awakeFromNib
     a = TestObject.alloc.init
     a.test
   end
end

Revision: the latest trunk
Project: http://limechat.net/macruby/ObjcTest.zip

/Users/psychs/dev/macruby/ObjcTest/build/Release/ObjcTest.app/Contents/ 
Resources/appcontroller.rb:7:in `awakeFromNib': private method `test'  
called for #<TestObject:0x10af580> (NoMethodError)
	from /Users/psychs/dev/macruby/ObjcTest/build/Release/ObjcTest.app/ 
Contents/Resources/rb_main.rb:22:in `NSApplicationMain'
	from /Users/psychs/dev/macruby/ObjcTest/build/Release/ObjcTest.app/ 
Contents/Resources/rb_main.rb:22:in `<main>'

--
Satoshi Nakagawa



More information about the MacRuby-devel mailing list