Search code examples
iosnstimer

NStimer stopped at middle


I am doing one application.In that,i am calling one method for every 10 seconds using the timer.But after sometime that method is not calling. So,may i know the reason for why timer is stopped.


Solution

  • If there is a ScrollView scrolling, the timer in NSDefaultRunLoopMode will be stopped.

    You can use this to fix it: [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];