Reputation: 1692
I am using simple code to start a repetitive timer which calls a method after every 30 seconds.
[NSTimer scheduledTimerWithTimeInterval:30 target:self selector:@selector(refresh) userInfo:nil repeats:YES];
It starts properly but after some time it calls the 'refresh' method after every 2 or 3 seconds randomly. I am not modifying the timer or anything anywhere else in the code . Any guess what could be possibly going wrong .....
Thank You!!
Upvotes: 0
Views: 288
Reputation: 58448
Is it possible that this code is being run more than once, thus setting up multiple instance of a timer with a 30 second timeout, all firing at different times?
If that isn't the case, is it possible that some of the processing you're doing is perhaps blocking the run loop and causing the timer events to queue up?
I would suggest checking those possibilities.
Upvotes: 1