FROM : Ali Ozer
DATE : Wed Apr 13 21:48:14 2005
Are you running this in a modal panel, or in the context of some
other processing? scheduleTimer... method adds the timer to the
default runloop mode, which doesn't fire in modal panels, event
processing, or other custom modes. You can use NSRunLoop's
addTimer:forMode: to specify other modes. Note the special mode,
(NSString *)kCFRunLoopCommonModes, which represents the default,
modal, and event processing modes, as well as any modes registered as
"common."
Ali
Begin forwarded message:
> From: John Draper <<email_removed>>
> Date: April 12, 2005 19:57:26 PDT
> To: <email_removed>
> Subject: NSTimer question...
>
>
> 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
>
DATE : Wed Apr 13 21:48:14 2005
Are you running this in a modal panel, or in the context of some
other processing? scheduleTimer... method adds the timer to the
default runloop mode, which doesn't fire in modal panels, event
processing, or other custom modes. You can use NSRunLoop's
addTimer:forMode: to specify other modes. Note the special mode,
(NSString *)kCFRunLoopCommonModes, which represents the default,
modal, and event processing modes, as well as any modes registered as
"common."
Ali
Begin forwarded message:
> From: John Draper <<email_removed>>
> Date: April 12, 2005 19:57:26 PDT
> To: <email_removed>
> Subject: NSTimer question...
>
>
> 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
>
| 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

