On Wed, Nov 17, 2010 at 12:41 PM, Lorenzo Thurman <lorenzo7...@gmail.com>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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to