2017-04-25 56 views
-2

我正在做一个应用程序。在那,我打电话每10秒使用计时器的一种方法,但有时后,该方法是不是调用。那么,我可否知道定时器停止原因。NStimer停在中间

+0

份额一些代码。 – KKRocks

+0

刚刚启动计时器myTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(recordFile1 :) userInfo:Nil repeatats:YES]; – venkat

+0

http://stackoverflow.com/a/25658491/2522457 - 请检查此。 somtimes之后的 –

回答

0

如果您在前台和后台查看Timer,Timer将在前台连续工作,但在后台只能工作10分钟,之后定时器将无法工作。

0

如果有滚动视图滚动,NSDefaultRunLoopMode中的计时器将被停止。

您可以用它来修复它: [[NSRunLoop mainRunLoop] addTimer:timer forMode:NSRunLoopCommonModes];