• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTimer won't fire.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimer won't fire.


  • Subject: Re: NSTimer won't fire.
  • From: zeichensprecher <email@hidden>
  • Date: Thu, 2 Dec 2004 15:10:16 +0100

Hi Joar,

I want to fire a timer, but whatever I do, the timer gets _never_ fired, exept when I call [timer fire].
What type of application is this? If it's not a "standard Cocoa application",

It is pure Cocoa / Objective-C. Just one additional MIDI-framework. NSDocument structure, has windows, controllers and everything else...


are you sure that the run loop is running, and that you're running in the default run loop mode?

Well, actually I'm not sure, but I thought it's like this:

1. I add the timer to [NSRunLoop currentRunLoop],
2. then I release the timer, because the manual tells me it is retained by adding to the runLoop
3. _then_ I call [timer isValid] =>
if the runLoop would _not_ have added the timer, it wouldn't be there anymore, because the timer had never been retained,


isn't that the case?



Moreover: the timer gets fired, when I explicitly call [timer fire].
But it does never fire by itself ???


Michael.



// ----- SNIPPET -----
[[NSRunLoop currentRunLoop] addTimer:noteOffTimer forMode:NSDefaultRunLoopMode];

[noteOffTimer release]; // gets retained by runLoop

if([noteOffTimer isValid]) {
NSLog(@"noteOffTimer will fire in @%f seconds \n time NOW: %@ \n time FIRE: %@",
fireTime, [NSDate dateWithTimeIntervalSinceNow:0], [noteOffTimer fireDate]);
// the timer is valid, becaue NSLog logs every time
//[noteOffTimer fire]; // tester if selector are O.K. (they are!)
// and this is most strange: if timer is fired from here, it is received, if not, it never comes...
// ----- SNIPPET -----


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSTimer won't fire.
      • From: j o a r <email@hidden>
    • Re: NSTimer won't fire.
      • From: Shaun Wexler <email@hidden>
References: 
 >NSTimer won't fire. (From: zeichensprecher <email@hidden>)
 >Re: NSTimer won't fire. (From: j o a r <email@hidden>)

  • Prev by Date: Graphic's project
  • Next by Date: Fwd: Re: NSPanel and stopModal - how to focus on the main window again?
  • Previous by thread: Re: NSTimer won't fire.
  • Next by thread: Re: NSTimer won't fire.
  • Index(es):
    • Date
    • Thread