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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:01:11+00:00 2026-06-04T03:01:11+00:00

I have a requirement to store the present state of application using UIApplicationWillTerminateNotification and

  • 0

I have a requirement to store the present state of application using UIApplicationWillTerminateNotification and NSUserDefaults where i need to load the application with the previous state when the user has logged out from the Application. My application is a TabBar Based Application and inturn its a Navigation Controller. I need to store the present view controller loaded in the navigation Controller and the present tab where the Navigation Controller is present. My application works for different user and i need to store the state of the application particular to the user. So, i need to store the user data as well. I searched it in StackOverflow and Googled it to find that we need to use something like NSUserDefaults and UIApplicationWillTerminateNotification is necessary for the same. This is the first time i am coming across these stuff. Can someone please post some tutorial or any sample code on how to get my requirement done?

  • 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-04T03:01:13+00:00Added an answer on June 4, 2026 at 3:01 am

    You can register for the notifications themselves (see NSNotificationCenter) and write your save/load code there, or you can put your code in the AppDelegate, which provides these hooks:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions;
    - (void)applicationWillResignActive:(UIApplication *)application;
    - (void)applicationDidEnterBackground:(UIApplication *)application;
    - (void)applicationWillEnterForeground:(UIApplication *)application;
    - (void)applicationDidBecomeActive:(UIApplication *)application;
    - (void)applicationWillTerminate:(UIApplication *)application;
    

    Look in the AppDelegate.m file, and you can see stub implementation with some documentation as to how they are to be used.

    In there, you will simply write your data to, and read it from NSUserDefaults, as appropriate.

    // Store the data
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    [defaults setObject:fooObject forKey:@"Foo"];
    [defaults setObject:barObject forKey:@"Bar"];
    [defaults synchronize];
    
    // Load the data
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSString *fooObject = [defaults objectForKey:@"Foo"];
    NSString *barObject = [defaults objectForKey:@"Bar"];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my application I have the requirement to store, for the period the user
I am using MySQL for my database. I have a requirement to store a
I have a requirement where I need to store the records at rate of
Environment: Workflow Foundation 4, SQL persistence store. Requirement: I have a bookmark which has
We have a requirement in which we need to load around 4000 records in
I have a requirement to store user uploaded files to the database (filesystem is
I am using silverlight4 app ,i have a requirement like to store the word/pdf
I have a requirement to store the list of services for multiple computers. I
I have a requirement for a program I'm working on to store job numbers
I have requirement where some times I would like to load children as well

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.