NSTimer stop when app is hide?
I just want to know why a NSTimer is stoping when the application is hidden or "Hide other" in an other application ? how can I re开发者_C百科medy this ?
Thanks
Maybe your timer is getting garbage collected or otherwise freed perhaps by the autorelease pool, and hence does not fire anymore.
Try doing this:
- (IBAction)recordCam1:(id)sender {
myTimer = [NSTimer scheduledTimerWithTimeInterval:1 target:self selector:@selector(recordFile1:) userInfo:Nil repeats:YES];
[myTimer retain];
}
where myTimer is an instance variable in your class. See if that produces a different behaviour. If so, then you know the problem is to do with memory management.
精彩评论