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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:44:06+00:00 2026-05-22T17:44:06+00:00

I have a navigation based iPhone application. in the Middle of the application sometimes

  • 0

I have a navigation based iPhone application. in the Middle of the application sometimes i am receiving the memory warning level 1 and 2. Suddenly all the values i fetched from database and created based on the user input in root viewcontroller including the values i saved in the nsuserdefaults losed totally. When i try come back to the root view controller i have empty table view without any data.

How to handle this issue, Please suggest any solution for this problem?

  • 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-22T17:44:06+00:00Added an answer on May 22, 2026 at 5:44 pm

    This is how it works, "unfortunately". When the didReceiveMemoryWarning comes in, your views are released and this explain why you don’t find any value in the table.

    What one should do is be prepared to create again all the views, according to Apple Docs.

    The default implementation of this method checks to see if the view controller can safely release its view. This is possible if the view itself does not have a superview and can be reloaded either from a nib file or using a custom loadView method. If the view can be released, this method releases it and calls the viewDidUnload method.

    You can override this method (as needed) to release any additional memory used by your view controller. If you do, be sure to call the super implementation at some point to allow the view controller to release its view. In iOS 3.0 and later, if your view controller holds references to objects in the view hierarchy, you should release those references in the viewDidUnload method instead. In earlier versions of iOS, you should continue to release them from this method. See the discussion in the viewDidUnload method for information about how to safely release outlets and other objects.

    If you want to implement those guidelines, a way to go is:

    1. use viewDidLoad/viewDidUnload to "save/restore" your data;

    2. store your data in a model independent from your views;

    3. in viewDidUnload, called after a warning`, store in your controller enough information about the view state (i.e., if it is displaying data about a customer, his customer/ID), so that you can recreate that information by getting the data back from the model;

    4. in viewDidLoad, called also when the view is restored after a memory warning, use the information that you saved in your view controller (if it is there), to recreate the view in the exact state where it was left (otherwise, put it in a default state).

    This should make it pretty easy.

    One trick that you could deploy if it makes sense to you is the following:

    1. override -didReceiveMemoryWarning in your view controllers;

    2. for any view that you really don’t want to be automatically released, don’t call [super didReceiveMemoryWarning] in your -didReceiveMemoryWarning override.

    Beware, this will make your life easier now, but will also defeat an important mechanism Apple has put in there to recover memory. This will not produce a crash in itself, but could make your device memory to fill up and your app be closed abruptly if you manage many views or your views are memory intensive (lots of graphics, etc.). So, your judgement here…

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

Sidebar

Related Questions

I have a navigation based application for the iPhone that I am working that
I have developed an iPhone application based on Tab bar & Navigation bar and
I've recently added landscape autorotation to my iPhone navigation based application, however I'm having
I have a navigation based iPhone app. Normally you start on the RootViewController, there
I have a navigation based iPhone app. When you press on a cell in
Hey. I have a Navigation-controller-based application with a number of Viewcontrollers in it which
I have a navigation based iPhone app, and I want to load a view
I have a navigation based application. when I click on a table's row next
I have a Navigation based application, in which I open a subview for the
I have a window within an iPhone application, which is displayed modally to allow

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.