[MacRuby-devel] performSelectorOnMainThread Problem

Daniel Westendorf daniel at prowestech.com
Mon Oct 10 07:48:30 PDT 2011


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 at 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 at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>


More information about the MacRuby-devel mailing list