FROM : Joshua Orr
DATE : Mon Apr 25 23:25:10 2005
Yes, the main thread always works (because it should always have a NSRunLoop
running), but you can make it work on other threads as long as you have a
NSRunLoop running on the thread you want to make the timer on.
> Assuming that your called went through the
> scheduleTimerWithTimeInterval call, you might be having problems with
> being on a separate thread? The timer should wants to run on the main
> thread.
>
> hope that helps,
> Mirna
>
> On Apr 12, 2005, at 7:57 PM, John Draper wrote:
>
>> I have a method like this... in my main Controller...
>>
>> - (void)noAnswerIn:(NSTimeInterval)seconds
>> {
>> // Create a new timer with the new refreshtime.
>> if (noAnswerTimeout == nil) {
>> NSLog(@"Starting no-answer timer");
>> noAnswerTimeout = [NSTimer
>> scheduledTimerWithTimeInterval:seconds
>> target:self
>>
>> selector:@selector(noAnswer:)
>> userInfo: nil
>> repeats:NO];
>> }
>> }
>> - (void)noAnswer:(id)sender
>> {
>> NSLog(@"I never get here");
>> // I do my stuff here if after a period of "seconds" above
>> expires.
>>
>> // of course we have to do this to ditch our timer when done.
>> [noAnswerTimeout invalidate]; // Ditch the timer - no longer
>> needed.
>> noAnswerTimeout = nil; // Loose reference to it.
>>
>> }
>>
>> I never get to the noAnswer callback. What am I missing?
>> What things can I do to check into why this isn't working?
>>
>> John
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>>
>> This email sent to <email_removed>
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
DATE : Mon Apr 25 23:25:10 2005
Yes, the main thread always works (because it should always have a NSRunLoop
running), but you can make it work on other threads as long as you have a
NSRunLoop running on the thread you want to make the timer on.
> Assuming that your called went through the
> scheduleTimerWithTimeInterval call, you might be having problems with
> being on a separate thread? The timer should wants to run on the main
> thread.
>
> hope that helps,
> Mirna
>
> On Apr 12, 2005, at 7:57 PM, John Draper wrote:
>
>> I have a method like this... in my main Controller...
>>
>> - (void)noAnswerIn:(NSTimeInterval)seconds
>> {
>> // Create a new timer with the new refreshtime.
>> if (noAnswerTimeout == nil) {
>> NSLog(@"Starting no-answer timer");
>> noAnswerTimeout = [NSTimer
>> scheduledTimerWithTimeInterval:seconds
>> target:self
>>
>> selector:@selector(noAnswer:)
>> userInfo: nil
>> repeats:NO];
>> }
>> }
>> - (void)noAnswer:(id)sender
>> {
>> NSLog(@"I never get here");
>> // I do my stuff here if after a period of "seconds" above
>> expires.
>>
>> // of course we have to do this to ditch our timer when done.
>> [noAnswerTimeout invalidate]; // Ditch the timer - no longer
>> needed.
>> noAnswerTimeout = nil; // Loose reference to it.
>>
>> }
>>
>> I never get to the noAnswer callback. What am I missing?
>> What things can I do to check into why this isn't working?
>>
>> John
>>
>> _______________________________________________
>> Do not post admin requests to the list. They will be ignored.
>> Cocoa-dev mailing list (<email_removed>)
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>>
>> This email sent to <email_removed>
>>
>
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> Cocoa-dev mailing list (<email_removed>)
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/<email_removed>
>
> This email sent to <email_removed>
| Related mails | Author | Date |
|---|---|---|
| John Draper | Apr 13, 04:57 | |
| Nathan Day | Apr 13, 06:15 | |
| Robert Martin | Apr 13, 07:29 | |
| Anthony Duer | Apr 13, 08:22 | |
| daniel | Apr 13, 08:43 | |
| Will Mason | Apr 13, 08:49 | |
| daniel | Apr 13, 08:57 | |
| Ali Ozer | Apr 13, 21:48 | |
| Daniel Jalkut | Apr 19, 07:07 | |
| Mirna Pena | Apr 25, 20:59 | |
| Joshua Orr | Apr 25, 23:25 |






Cocoa mail archive

