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.
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 <alex@greifdesign.net> 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 MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
participants (2)
-
Alex Greif
-
Daniel Westendorf