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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T19:54:05+00:00 2026-06-11T19:54:05+00:00

Prior to iOS 6, we were supposed to – (void)viewDidUnload { self.someDelegate = nil;

  • 0

Prior to iOS 6, we were supposed to

- (void)viewDidUnload {
   self.someDelegate = nil;
   [super viewDidUnload];
}

Now that viewDidUnload is deprecated, where do we set our delegates to nil? Thanks!

  • 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-11T19:54:06+00:00Added an answer on June 11, 2026 at 7:54 pm

    Views are no longer unloaded when receiving a memory warning in iOS6. So the view is never unloaded on such cases and viewDidUnload is never called in iOS6.

    If you really want to mimic the old behavior (unloading the view upon receiving a memory warning) you now have to implement this behavior in the didReceiveMemoryWarning method of your view controller, after testing that the self.view.window property is nil (meaning the view is not on screen anymore, thus will be “unloaded”, meaning that you are in the same situation as the old viewDidUnload case).

    -(void)didReceiveMemoryWarning
    {
        if (self.isViewLoaded && !self.view.window)
        {
            // If view already loaded but not displayed on screen at this time (not attached to any window) then unload it
            self.view = nil;
    
            // Then do here what you used to do in viewDidUnload
            self.someDelegate = nil;
            ...
        }
        [super didReceiveMemoryWarning];
    }
    

    But note that if you use ARC and iOS5+, you generally won’t need to set your delegate to nil anymore, thanks to the weak property attribute and the Zeroing-Weak-References mechanism that automatically reset weak variables and properties to nil if the object they are pointing to does not exist anymore (thus avoiding dangling pointers).

    [EDIT] And as explained by @Martin R in the comments, views are not unloaded anymore when receiving a memory warning in iOS6, so you won’t have to manage this case of receiving a memory warning and think about releasing your delegate there as this use case won’t occur anymore in iOS6.

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

Sidebar

Related Questions

Prior to iOS 4.0, CoreLocation was reporting altitude correctly, now it always reports as
I have a program that ran in iOS 2.0 and now am making some
Prior to C++11, if I had a function that operated on large objects, my
I saw in the documentation that now you can have an array of items
Does the OS purge the Caches directory prior to iOS 5?
I want to release UIViewController object in iOS 5. Prior iOS versions (>5.0) we
I am tasked with making an app that works in iOS 4.0 work in
My app only supports landscape orientations via the supportedInterfaceOrientation properties. Using an iOS prior
Anyone know how to set the time zone in an NSDate object prior to
Prior to iOS 5.1 if you wanted to use NSCoding protocols with UIImage you

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.