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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T12:17:03+00:00 2026-05-22T12:17:03+00:00

Have a peek at the documentation for didReceiveMemoryWarning: http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html Note how it says, and

  • 0

Have a peek at the documentation for didReceiveMemoryWarning:

http://developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

Note how it says, and I quote:

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.

Why is this the case? What changed in iOS 3.0 that made it so that view-hierarchy views must not be cleaned up directly in didReceiveMemoryWarning? I can’t imagine what could possibly make that dangerous or bad.

Any ideas guys?

  • 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-22T12:17:04+00:00Added an answer on May 22, 2026 at 12:17 pm

    In iOS 3.0 viewDidUnload and viewDidLoad were introduced.

    If you look at their description, you’ll see that:

    viewDidLoad called after the view controller has loaded its associated views into memory. This method is called regardless of whether the views were stored in a nib file or created programmatically in the loadView method.

    This means that, both when your view is loaded from a Nib, or when you create it programmatically (and the framework calls for you at the right moment loadView), you have a single point where you can access your new view and complete its initialization, like adding subviews, or whatever you need.

    The counterpart to viewDidLoad is viewDidUnload that you can override like this:

    -(void)viewDidUnload {
         <do all the necessary clean up>
        [super viewDidUnload];
    }
    

    so, you have one single point for clean-up, and you don’t need to do any specific clean-up in didReceiveMemoryWarning, because viewDidUnload is called whenever a view is deallocated, i.e., also when it is deallocated due to didReceiveMemoryWarning.

    This is different to what happened previously to iOS 3.0, where you had to come out with your own scheme for completing initialization and clean-up with no support from the framework, i.e. when didReceiveMemoryWarning caused a view to be deallocated, your clean-up method was not automatically called and you had to duplicate your clean-up code (and explicitly do the clean-up in didReceiveMemoryWarning).

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

Sidebar

Related Questions

Should be pretty simple: I have an InputStream where I want to peek at
I have a class library assembly and some test code. Because the test code
Possible Duplicate: Why have “while(1);” in XmlHttpRequest response? If you take a peek at
I'd like to have a peek at Derby's database log; I don't mean the
I'm trying to build a simple parser, and since InputStream doesn't have some peek-like
I have a Gem that I found at RubyForge and want to peek inside
Possible Duplicate: C equivalent to fstream's peek Say I have a file with characters
Have just started using Google Chrome , and noticed in parts of our site,
Have you ever seen any of there error messages? -- SQL Server 2000 Could
Have you guys had any experiences (positive or negative) by placing your source code/solution

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.