• 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: Getting NSTimer to work after an NSThread completes?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: Getting NSTimer to work after an NSThread completes?
      • From: "Michael Ash" <email@hidden>
    • Re: Getting NSTimer to work after an NSThread completes?
      • From: Alex Reynolds <email@hidden>
References: 
 >Getting NSTimer to work after an NSThread completes? (From: Alex Reynolds <email@hidden>)

  • Prev by Date: Getting NSTimer to work after an NSThread completes?
  • Next by Date: Re: comparing Strings.
  • Previous by thread: Getting NSTimer to work after an NSThread completes?
  • Next by thread: Re: Getting NSTimer to work after an NSThread completes?
  • Index(es):
    • Date
    • Thread