0

i have a implemented NSTimer with timer = [NSTimer scheduledTimerWithTimeInterval:20 target:self selector:@selector(methodName) userInfo:nil repeats:YES]; in UIViewController.

It is working fine without any issue. But if when i click iphone home button applicationDidEnterBackground will be call. I minimize the application for 10 second than i open app again. So methodName will be called after 10 second and its working. i dont have any issue with this. I just want to know that when app gone in backgroudmode timer is running on backgroud ???

i think it timer is working in backgroud so it call after 10 second otherwise it called after 20 second.

What timer will do when app is go in backgroud mode ?? It preserve the last time ?

NSTimer will consume the memory in backgroud ??

Hitarth
  • 1,950
  • 3
  • 27
  • 52
  • 1
    timer will paused when app enters background and will start from the paused state when app enters foreground – Aman Aggarwal Jun 04 '13 at 05:42
  • it won't run in background you have to manage in your app when your app goes in background and when it comes in foreground. – Leena Jun 04 '13 at 05:45
  • 1
    check this :-http://stackoverflow.com/questions/8613487/timer-how-to-remain-timer-active-in-background – Nitin Gohel Jun 04 '13 at 05:55
  • @AmanAggarwal so it will automatically Paused and start(with last time) when app is in background to forground ? – Hitarth Jun 04 '13 at 06:13
  • No, it won't. The timer does keep running. It doesn't resume from where you shut it down. If you click the home button right after it fires, then wait 15 seconds and restart the app, it will fire in approx. 5 seconds, not almost 20. Test it yourself, it's easy enough to do. – rdelmar Jun 04 '13 at 06:31
  • @rdelmar yes i have test this. so according to you timer is running in backgroud ? not gone to Pause state and resume state ? – Hitarth Jun 04 '13 at 06:43

0 Answers0