• 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 firedate randomly changes
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTimer firedate randomly changes


  • Subject: Re: NSTimer firedate randomly changes
  • From: Kyle Sluder <email@hidden>
  • Date: Wed, 17 Nov 2010 13:35:35 -0800

On Wed, Nov 17, 2010 at 12:41 PM, Lorenzo Thurman <email@hidden>wrote:

> I use two NSTimers in my app. One runs a "mini" data fetch at regular
> intervals. I use another to run a "full" data fetch every 4 hours. The
> problem I'm running into is that while the mini fetch runs as scheduled,
> the
> full fetch never runs. I put some NSLog statements in the code to output
> the
> firedate for both timers whenever the either fetch runs. What I see is that
> only the mini timer fires, always on schedule, but the full fetch timer's
> firedate is always offset forward by some random value in minutes so far
> (+35, +42, +72, etc.) and as a consequence, it never fires. I would expect
> its firedate to remain constant until it fires. I reset the mini timer
> after
> it fires as it needs to check if the user has changed the interval, but
> there is no code that resets the full fetch timer; no need, it should run
> every 4 hours.
>

That's not how timers work. They only fire if something wakes the runloop
after their time has expired. Usually this is an event.

Read the Overview section of the NSTimer reference:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html

--Kyle Sluder
_______________________________________________

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: NSTimer firedate randomly changes
      • From: Shawn Erickson <email@hidden>
    • Re: NSTimer firedate randomly changes
      • From: Greg Parker <email@hidden>
References: 
 >NSTimer firedate randomly changes (From: Lorenzo Thurman <email@hidden>)

  • Prev by Date: Running JavaScript in iOS WebView.
  • Next by Date: Re: NSTimer firedate randomly changes
  • Previous by thread: NSTimer firedate randomly changes
  • Next by thread: Re: NSTimer firedate randomly changes
  • Index(es):
    • Date
    • Thread