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

  • Home
  • SEARCH
  • 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

I have an asp mvc 2 app lication where I want to display a
I have an ASP.NET MVC view which contains checkboxes for user-defined categories. <td><% foreach
On my site, the user can watch his profile. In his profile he can
Basically I want to implement a simple Rails extension to define the seriousness of
By default, the MVC Authorize attribute sets the HttpContext.Response.StatusCode = 401 when a user
I have a view called Associations that has a drop down list and a
Okay, I've been struggling with this for a while now. I have a standard
I'm showing a small table with a list of usernames, and I want an
I'm building a user panel, and having some problems with data validation. As an
I'm using this . I've put this in where the images are added: self.autoresizingMask

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.