Re: Getting NSTimer to work after an NSThread completes?
Re: Getting NSTimer to work after an NSThread completes?
- Subject: Re: Getting NSTimer to work after an NSThread completes?
- From: Jason Coco <email@hidden>
- Date: Tue, 7 Oct 2008 04:42:20 -0400
On Oct 7, 2008, at 04:06 , Alex Reynolds wrote:
However, if I skip the NSThread instantiation step, then my NSTimer
starts working again.
I have also tried:
[[NSRunLoop currentRunLoop] addTimer:myNSTimer
forMode:NSDefaultRunLoopMode];
in my new view, but this does not work either.
What should I do to get an NSTimer to work after an NSThread
completes?
Your notification is getting dispatched to the wrong thread. If you
can target 10.5, do this:
[[NSRunLoop mainRunLoop] addTimer:myNSTimer
forMode:NSDefaultRunLoopMode];
If you must target earlier versions of MacOS, there is a lot of
documentation on re-dispatching
notifications back to a specific thread... although it's much more
complicated than the above
and I don't have the links at the moment...
HTH, Jason
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden