0

I found that when I double-tap home button to bring up the springboard, then hold and kill my app, applicationWillTerminate: is not triggered.

This leaves me puzzled as to where I should place my termination procedures.

I looked at this post: How to know whether app is terminated by user or iOS (after 10min background) which says otherwise.

I'm running iOS 6.1.3 on a 5th-gen iPod.

Community
  • 1
  • 1
kakyo
  • 10,460
  • 14
  • 76
  • 140
  • 1
    Just leave them there. If SpringBoard restarts, all apps are hard-killed without any notification whatsoever. You can't do anything about that. –  Sep 05 '13 at 13:50
  • Thanks. But I do need to take care of termination in case user kills the app that way, some resources have to be released. – kakyo Sep 05 '13 at 13:51
  • Now think about it. On any decent OS, if a process is killed, its acquired resources are reclaimed by the kernel automatically. Thus, any kind of `dealloc`, `free()` and `fclose()` are redundant when your app is killed. –  Sep 05 '13 at 13:52
  • Well, it is a little more complicated in my case because we do have some internal logic that could lock up threads. If that happens and user tap our app again very quickly , we get the locked-up previous instance of the app. But if user waits a little bit, it terminates fine. – kakyo Sep 05 '13 at 13:54
  • 1
    You should handle `applicationDidEnterBackground:` which is called when your app initially goes into the background. – Mike Weller Sep 05 '13 at 13:54
  • @kakyo How do you manage to leave dangling threads there when the app is **actually, forcibly killed by the OS?** –  Sep 05 '13 at 13:56
  • @H2CO3 I had the same doubt, but it just happened, meaning that the springboard kill does not always "kill" completely if user quickly tap the app to open it again. – kakyo Sep 05 '13 at 13:57
  • @kakyo That is really weird. What iOS version are you testing your app on? –  Sep 05 '13 at 13:58
  • @kakyo Ah, OK. 6.1.3. Well... I have to see this myself, for sure! I hope I'll be able to come up with an answer. –  Sep 05 '13 at 13:59
  • @MikeWeller Do you mean that the init/term sequences should be handled in WillEnterForeground / DidEnterBackground pair? – kakyo Sep 05 '13 at 14:06

0 Answers0