iphone - NSTimer getting zombie -


i have created nstimer in application gets fired after every 1 min interval. problem when put application in background , after time 5 min, bring in foreground, timer object gets zombied.

any thoughts on this.

perhaps invalidate timer when application enters background start again when application enters foreground.

like so:

- (void)applicationdidenterbackground:(uiapplication *)application {     [mytimer invalidate]; }  - (void)applicationwillenterforeground:(uiapplication *)application {     mytimer = [nstimer scheduledtimerwithtimeinterval:60.0 target:self selector:@selector(timerfunction) userinfo:nil repeats:yes]; } 

Comments

Popular posts from this blog

Python __call__ special method practical example -

How can I edit my VIM config so that Vim treats ".ejs" files the same as it currently treats my html files? -