Which function is called when iPhone app is terminated?

后端 未结 5 2104
陌清茗
陌清茗 2020-12-11 04:42

I\'m working on a project in Xcode version 4.2.1 and in iOS 5.0. I\'m wondering which function will be called when you completely terminate an application, which means even

5条回答
  •  失恋的感觉
    2020-12-11 05:16

    The documentation here spells out the behavior for this case.

    In short, you'll only receive the applicationWillTerminate: message if the app is running (either in the foreground or background) when it's terminated. So, unless your app is running in the foreground or in one of the long-running background modes (e.g. VoIP, Audio, or a long-running task indicated by beginBackgroundTaskWithExpirationHandler) it will transition from the background state to the suspended state fairly quickly. In this case, you'll never receive the applicationWillTerminate: message.

提交回复
热议问题