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 449527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T21:46:42+00:00 2026-05-12T21:46:42+00:00

If the user is currently in my edit view controller, I want to be

  • 0

If the user is currently in my edit view controller, I want to be able to save the changes when the user closes my app. To do this I am observing the UIApplicationWillTerminateNotification of the shared application. In my app delegate, I use the applicationWillTerminate: method to close things down and release all my core data contexts.

The problem I’m finding is that the applicationWillTerminate: method in the app delegate gets called before any observers react to the UIApplicationWillTerminateNotification notification. This means that my core data stack has been released and closed before my edit view controller gets a chance to save anything!

How is this usually overcome because I can’t see a way!

Many thanks,

Michael

  • 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-05-12T21:46:43+00:00Added an answer on May 12, 2026 at 9:46 pm

    Edit: The first (notification-based) approach probably won’t work due to the inner workings of run loops and notifications.

    If you want to stick with the notification-based architecture, you can actually post your own notifications from within applicationWillTerminate:. Simply create your own MyApplicationWillTerminate notification, then call postNotification: on [NSNotificationCenter defaultCenter]. Then have your edit controller register for instances of MyApplicationWillTerminate rather than the default UIApplicationWillTerminateNotification.

    Another choice is to have your app delegate store an instance of your edit controller if it’s visible, then in applicationWillTerminate: save the new info before releasing the Core Data context. This pollutes your app delegate with extra instance variables, though, so it may not be the optimal solution.

    A last thought: why not have the app save whatever edits are being made as the user makes them? That way, you don’t have to worry about the app closing halfway through editing a piece of info – the edits are already saved, and you can simply release the Core Data stuff as you already are. (This may not be appropriate for you; I really couldn’t say without knowing more about your app structure and what data you’re editing.)

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

Sidebar

Related Questions

Users can view and edit account information in my app using UsersController This controller
How would I be able to check what language the user is currently viewing
I'm using devise gem and showing user's objects on registrations/edit view. I have such
I'm sure this is basic as I'm a new Rails user and want to
I want to update/edit a devise user from my own form in my project,
Im pulling a text file - it will be input by user currently its
I have an application where there are two types of user currently, Admin and
Basically i am trying to find out what version of ArcGIS the user currently
How do I know if a specific twitter user is currently online by writing
I'm trying to enable screenshots of the page a logged in user is currently

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.