From: Allison N. <dem...@ma...> - 2010-03-19 08:12:51
|
Wolfgang, When you want to call a super method, you have to do it from inside a method having exactly the same signature/name. So this works: >> class VC >> def initWithNibName_bundle(nibname, bundle) >> super_initWithNibName_bundle(nibname, bundle) >> end >> end => nil >> vc = VC.alloc.initWithNibName_bundle('dummy', nil) => #<VC:0x32e416 class='VC' id=0x1a001c0> If you really want to have just a plain init method, you could then define it as: def init initWithNibName_bundle('dummy, nil) end > vc = VC.alloc.init => #<VC:0x31c306 class='VC' id=0x1a24210> Please note that the signature of the method really does have to be identical, with the same number of parameters. Alli Le 19 mars 10 à 08:44, Wolfgang Kittenberger a écrit : > I run into an other challenge with the bridge: > > When initializing a subclass of NSViewController, the bridge claims, > that super:initWithNibName:bundle: is a missing method. > > Here an sample irb session: >>> require 'osx/cocoa' > => true >>> include OSX > => Object >>> class VC < NSViewController >>> def init >>> super_initWithNibName_bundle('dummy',nil) >>> end >>> end > => nil >>> vc = VC.alloc.init > OSX::OCMessageSendException: Can't get Objective-C method signature > for selector 'super:initWithNibName:bundle:' of receiver #<VC: > 0x8093c60c class='VC' id=0x101edeb30> > from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/ > objc/oc_wrapper.rb:50:in `ocm_send' > from /Library/Frameworks/RubyCocoa.framework/Resources/ruby/osx/ > objc/oc_wrapper.rb:50:in `method_missing' > from (irb):5:in `init' > from (irb):8 >>> > > I can verify the presence of the initWithNibName:bundle: method > >>> VC.superclass > => OSX::NSViewController >>> VC.objc_instance_methods.sort > ...,"infoForBinding:", "init", "initWithCoder:", > "initWithNibName:bundle:", "insertText:",... > > What is my fault? > > Best regards > Wolfgang Kittenberger > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > Rubycocoa-talk mailing list > Rub...@li... > https://lists.sourceforge.net/lists/listinfo/rubycocoa-talk |