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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T01:53:05+00:00 2026-05-21T01:53:05+00:00

So, under low memory, my root view is unloaded. That’s expected and accounted for.

  • 0

So, under low memory, my root view is unloaded. That’s expected and accounted for. However, how do I deal with modal/pushed view controllers who need to be popped, since they reference the main navigationController? I have a custom Done button in a pushed view controller, which calls [self.navigationController popViewControllerAnimated:YES]. If the root view has been unloaded, this gives a bad access error. Is there a better way to do this?

My setup is
AppDelegate has a NavigationController
this NavigationController has a view controller MainViewController

//MainViewController.m
- (IBAction)showAnotherController:(id)sender
{
    AnotherViewController *   anotherViewController;
    anotherViewController = [[AnotherViewController alloc] initWithNibName:@"AnotherView" bundle:nil];

    [self.navigationController pushViewController:anotherViewController animated:YES];
    [anotherViewController release];
}

//...Here I can simulate a memory warning to force unloading of MainViewController's view

//in AnotherViewController.m, called from a custom toolbar item
- (IBAction)done:(id)sender
{
    [self.navigationController popViewControllerAnimated:YES]; // bad access here, looks like self.navigationController is no longer available. Am I doing this wrong?

}
  • 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-21T01:53:05+00:00Added an answer on May 21, 2026 at 1:53 am

    The scenario you’re describing does not cause bad access. However, if you don’t handle the described scenario carefully you get bad access. Since you haven’t showed me any code I can’t tell you that this is the problem you’re having, but it’s a very common problem.

    When you receive a memory warning and your view is unloaded, you probably release a bunch of stuff. In addition to releasing the variables you also have to set them to nil. If you don’t, you’re facing the risk of sending messages to released objects, which causes bad access.

    Again, I can’t know that this is your problem, but it’s usually the problem.

    EDIT: Since you seem to believe that self.navigationController doesn’t exist (it probably does) I’m gonna tell you about something called NSZombie:

    NSZombie will tell you what released object is being sent a message (aka EXC_BAD_ACCESS). This is a very useful tool when you get EXC_BAD_ACCESS, so learn how to use it.

    To activate NSZombie do the following:

    1. Get info of the executable.
    2. Go to the arguments tab.
    3. In the “Variables to be set in the environment:” section add:

    Name: NSZombieEnabled
    Value: YES

    Then run your app as usual and when it crashes it should tell you which deallocated object received the message.

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

Sidebar

Related Questions

Under VS's external tools settings there is a Use Output Window check box that
Under the View-Model-ViewModel pattern for WPF, I am trying to databind the Heights and
Under what circumstances might you want to use multiple indirection (that is, a chain
I make a distributed embedded application that will make use of several micro-controllers. The
My goal is to write a custom camera view controller that: Can take photos
Update: I thought the issue was low memory; it's not. This error happens consistently
I have to design an application which to support under three resolution. for that
Under Windows XP WPF true 3D content (which is usually displayed using the Viewport3D
Under what circumstances - if any - does adding programmers to a team actually
Under what circumstances would this or would this not be safe? I have a

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.