Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8950565
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T13:28:49+00:00 2026-06-15T13:28:49+00:00

Is applicationDidEnterBackground ALWAYS called before applicationWillTerminate in an iOS app? I know that applicationWillTerminate

  • 0

Is applicationDidEnterBackground ALWAYS called before applicationWillTerminate in an iOS app? I know that applicationWillTerminate is not always called (multitasking) – but when it is called, is applicationDidEnterBackground ALWAYS called first? I don’t want to duplicate code unnecessarily by including it in applicationWillTerminate if it is already included in applicationDidEnterBackground, for an app that supports multitasking.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T13:28:50+00:00Added an answer on June 15, 2026 at 1:28 pm

    in ios 4.0 and later applicationDidEnterBackground is called instead of applicationWillTerminate so you don’t have to call both of them. Here is the portion of the Apple docs:

    Discussion

    In iOS 4.0 and later, this method is called instead of the
    applicationWillTerminate: method when the user quits an application
    that supports background execution. You should use this method to
    release shared resources, save user data, invalidate timers, and store
    enough application state information to restore your application to
    its current state in case it is terminated later. You should also
    disable updates to your application’s user interface and avoid using
    some types of shared system resources (such as the user’s contacts
    database). It is also imperative that you avoid using OpenGL ES in the
    background.

    Your implementation of this method has approximately five seconds to
    perform any tasks and return. If you need additional time to perform
    any final tasks, you can request additional execution time from the
    system by calling beginBackgroundTaskWithExpirationHandler:. In
    practice, you should return from applicationDidEnterBackground: as
    quickly as possible. If the method does not return before time runs
    out your application is terminated and purged from memory.

    You should perform any tasks relating to adjusting your user interface
    before this method exits but other tasks (such as saving state) should
    be moved to a concurrent dispatch queue or secondary thread as needed.
    Because it’s likely any background tasks you start in
    applicationDidEnterBackground: will not run until after that method
    exits, you should request additional background execution time before
    starting those tasks. In other words, first call
    beginBackgroundTaskWithExpirationHandler: and then run the task on a
    dispatch queue or secondary thread.

    The application also posts a
    UIApplicationDidEnterBackgroundNotification notification around the
    same time it calls this method to give interested objects a chance to
    respond to the transition.

    For more information about how to transition gracefully to the
    background, and for information about how to start background tasks at
    quit time, see iOS App Programming Guide.

    Hope this helps clear the issue for you man.
    Adrian

    Here is the link to the technical note that is available on developer section. It is dealing with networking and multitasking. The actual method used in this doc deals with only applicationDidEnterBackground and since iOS 5 they have a system called watchdog which terminates the app if the network is unresponsive automatically. Hence there is no need to actually call applicationWillTerminate and try to execute codes to allow your app to finish its task before the app is terminated. The app will enter the background and will continue its task until the last task is completed. I hope that makes sense, but here is the link. Please read the watchdog section.
    https://developer.apple.com/library/ios/#technotes/tn2277/_index.html#//apple_ref/doc/uid/DTS40010841

    Hope this helps. 🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The applicationWillTerminate delegate method is not getting called in iOS 4.0 When I hit
My app runs an NSTimer that updates the screen, but I want to stop
When an app crashes does either the 'applicationWillTerminate' or 'applicationDidEnterBackground' get called or am
I have an app that I want the user to be able to set
In my app from applicationDidEnterBackground i want to ask the application for more time
Im trying to find a way to save data before my app enters multitasking,
i'm developing a sample app that tracks the user's position in background, but i
What I want is that my app should stop playing sound when it enters
I have an app that always terminate, never goes to suspend mode. I have
I know that when iphone application goes to background, these methods are called: -

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.