0
我記錄了CMDeviceMotion
加速度數據的樣本,持續30秒到NSTimer
。事情是,當應用程序在前臺,一切都很好。間隔設置爲0.01
,並在30 seconds
,3000
中存儲讀數。但是當應用程序進入後臺時,我只能得到300
的讀數。當iOS應用程序轉到後臺時NSTimer更新間隔發生變化?
self.deviceMotionTimer = [NSTimer scheduledTimerWithTimeInterval:0.01 target:self selector:@selector(recordUpdates) userInfo:nil repeats:YES];
NSTimer是如何工作的?