[MacRuby-devel] performSelectorOnMainThread Problem
The xcode documentation states that if the method performSelectorOnMainThread has the argument withObject:nil, then the nil means that the target method takes no arguments. The following code throws an ArgumentError wrong number of arguments (1 for 0): def foo self.performSelectorOnMainThread(:'bar', withObject:nil, waitUntilDone:true) end def bar # some gui change end But it works fine if I add a dummy argument to the bar method and change the selector to 'bar:' like def foo self.performSelectorOnMainThread(:'bar:', withObject:nil, waitUntilDone:true) end def bar(dummy) # some gui change end Is this a bug, or do I really need the dummy argument in the target method? Thanks, Alex. ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
Re: [MacRuby-devel] performSelectorOnMainThread Problem
This is by design, as the method passes the caller to the selector. dw On Mon, Oct 10, 2011 at 7:54 AM, Alex Greif wrote: > The xcode documentation states that if the method > performSelectorOnMainThread has the argument withObject:nil, then the nil > means that the target method takes no arguments. > > > The following code throws an ArgumentError wrong number of arguments (1 > for 0): > > def foo > self.performSelectorOnMainThread(:'bar', withObject:nil, > waitUntilDone:true) > end > > def bar > # some gui change > end > > > But it works fine if I add a dummy argument to the bar method and change > the selector to 'bar:' like > > def foo > self.performSelectorOnMainThread(:'bar:', withObject:nil, > waitUntilDone:true) > end > > def bar(dummy) > # some gui change > end > > > Is this a bug, or do I really need the dummy argument in the target method? > > Thanks, > Alex. > > > ___ > MacRuby-devel mailing list > [email protected] > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel > ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
[MacRuby-devel] NSInvocationOperation usage Segmentation fault
The following code crashes with a segmentation fault. Any idea whether I misunderstood the usage or it is a macruby bug? thanks, ALex. ---code--- framework 'Foundation' class Foo def bar puts 'bar' end end operation = NSInvocationOperation.alloc.initWithTarget Foo.new, selector: 'bar', object: nil queue = NSOperationQueue.alloc.init queue.addOperation(operation) # run the main loop for 2 seconds NSRunLoop.currentRunLoop.runUntilDate(NSDate.dateWithTimeIntervalSinceNow(2.0)) ___ MacRuby-devel mailing list [email protected] http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
