NSTimerのリファレンスを見ていたらtolerance
という見慣れないプロパティが追加されていた。
https://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSTimer_Class/#//apple_ref/occ/instp/NSTimer/tolerance
iOS7以降で使える模様。
toleranceには寛容とか許容という意味がある。
要するにタイマーをリピートさせるときの次回発火時間を計算する際にtolerance
プロパティを加味して計算するということらしい。そして、tolerance
プロパティには経験則として少なくともintervalの 10% を与えてあげると良いとのこと。
NSTimeInterval timeInterval = 1.0;
NSTimer *timer = [NSTimer scheduledTimerWithTimeInterval:timeInterval target:self selector:@selector(updateData:) userInfo:nil repeats:YES];
timer.tolerance = timeInterval * (10.0 / 100.0);
設定した場合としなかった場合とで比較できてないけれど、基本的に設定しておくのが吉な気がする。