NSTimer doesn't fire in a Foundation tool
08/07/03 22:54
I want to use NSTimer in a Foundation tool but is doesn't work. What am I doing wrong ?
NSTimer objects are registered against a NSRunLoop, in a Foundation tool you don't have a run loop by default since there is no NSApplication object.
Hopefully you can create one very easily, by inserting the following code:
[[NSRunLoop currentRunLoop] run];
The same problem may arise if you try firing timer from another thread in a NSApplication-based application: you also need a run loop in this particular thread.
Hopefully you can create one very easily, by inserting the following code:
[[NSRunLoop currentRunLoop] run];
The same problem may arise if you try firing timer from another thread in a NSApplication-based application: you also need a run loop in this particular thread.