[MacRuby-devel] NSTimer
Robert Rice
rice.audio at pobox.com
Sun Oct 11 11:45:59 PDT 2009
Thanks John::
I wasn't familiar with this new syntax. I was using the old syntax
"NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats
" but I see it doesn't work in MacRuby.
MarRuby is giving me error messages without a traceback. Is there a
way to enable tracebacks?
Bob Rice
On Oct 11, 2009, at 12:58 PM, John Shea wrote:
> Hi Bob,
>
> (you are going to kick yourself) you have misplaced the colon
> between target and self - there is a comma there, and the colon has
> been placed in front of "target", so the method is not being
> recognised.
>
> eg:
> @synchro_timer = NSTimer.scheduledTimerWithTimeInterval
> (TIME_INTERVAL, target:self, selector:"synchronise_with_server:",
> userInfo:nil, repeats:true)
>
>
> as for threads - maybe someone else could chime in with a preference
> - but I do it the Cocoa way (eg http Connection delegates or timers)
> - but for data crunching using all cores I will use something like
> Laurent's barber shop code: http://www.macruby.org/blog/2009/10/07/macruby05b1.html
> .
>
>
> J
>
> On Oct 11, 2009, at 6:19 PM, Robert Rice wrote:
>
>> Congratulations MacRuby Development Team:
>>
>> My application almost runs now in MacRuby.
>>
>> Is NSTimer class supported in MacRuby?
>>
>> I was doing background processing using NSTimer as follows:
>>
>> @timer = NSTimer.scheduledTimerWithTimeInterval( 5.0, :target,
>> self, :selector, :periodicUpdate, :userInfo, nil, :repeats, true )
>>
>> but this now gives me the error:
>>
>> undefined method `scheduledTimerWithTimeInterval' for NSTimer:Class
>> (NoMethodError)
>>
>> Do you have a preferred method for doing backgound tasks in MacRuby
>> - perhaps separate threads?
>>
>> Thanks,
>> Bob Rice
>>
>> _______________________________________________
>> MacRuby-devel mailing list
>> MacRuby-devel at lists.macosforge.org
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
> _______________________________________________
> MacRuby-devel mailing list
> MacRuby-devel at lists.macosforge.org
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-devel/attachments/20091011/743d8222/attachment-0001.html>
More information about the MacRuby-devel
mailing list