Re: Singleton and NSTimer
Re: Singleton and NSTimer
- Subject: Re: Singleton and NSTimer
- From: Gregory Weston <email@hidden>
- Date: Wed, 6 Jul 2005 20:05:42 -0400
On Jul 6, 2005, at 6:02 PM, Brad Peterson wrote:
I have a singleton object which, in its init method, creates a timer:
[ NSTimer timerWithTimeInterval: 4 target: self
selector: @selector(timedPurge) userInfo: nil repeats:
YES ];
While I can tell that the timer is created, it never seems to fire.
Is this some limitation I'm otherwise unaware of?
Apparently. Consider the documentation:
"Returns a new NSTimer that, when added to a run loop, will fire
after seconds."
I'm guessing you haven't actually added the timer to a run loop. It
would be more common, I think, to create your timer with
scheduledTimerWithTimeInterval:target:selector:userInfo:repeats:.
G
_______________________________________________
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