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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T10:20:06+00:00 2026-06-06T10:20:06+00:00

ViewWillAppear is never called automatically I have to call them manually. ViewWillDisappear is often

  • 0

ViewWillAppear is never called automatically I have to call them manually. ViewWillDisappear is often called though.

I do not know where to debug this.

I suppose the problem is because I created the application on 4.1 where people have to call viewWillAppear explicitly.

I suppose, because viewWillAppear will be called depending on its relation with window I can check if my viewController has an outlet to window.

How do I do so?

I suspected the problem is somewhere in my delegate:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
    [Crashlytics startWithAPIKey:@"a08863b514ef09558ba82fec070cc7468fdbeeae"];
    if(getenv("NSZombieEnabled") || getenv("NSAutoreleaseFreedObjectCheckEnabled"))
    {
        NSLog(@"NSZombieEnabled/NSAutoreleaseFreedObjectCheckEnabled enabled!");
    }

    [self.window addSubview:self.navController.view]; //This seem to be the problem. I should have specified the viewController and not the view

    [self.navController pushViewController:self.MainBadgerApplication animated:YES];
    //[cachedProperties singleton].lastAnchor =[cachedProperties currentLocation];
    [cachedProperties singleton].currentAnchor=[cachedProperties currentLocation];
    self.MainBadgerApplication.selectedIndex=0;
    [BNUtilitiesQuick tabBarController:self.MainBadgerApplication didSelectViewController:self.MainBadgerApplication.selectedViewController];
    [self.window makeKeyAndVisible];

    return YES;
}

I suspected that
[self.window addSubview:self.navController.view]; is the issue.

Also I’ve heard before ios5 you do have to call viewController explicitly. So should I create a different program for ios5 and ios4 (not like there is any danger in calling viewController twice for my program)

  • 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-06T10:20:09+00:00Added an answer on June 6, 2026 at 10:20 am

    I suspected that [self.window addSubview:self.navController.view]; is the issue.

    Probably. You should be doing this instead:

    self.window.rootViewController = self.navController;
    

    Just adding the view doesn’t put your view controller into the hierarchy properly. See the WWDC 2011 view controller containment video for more information.

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

Sidebar

Related Questions

I know that viewWillAppear is not called on pop/push views, but I really need
i came across this problem, my code in the viewWillAppear method is not executed
I have got one problem with the UITableViewController... The viewWillAppear method is not getting
Update It has been mentioned that viewWillAppear and viewDidAppear do not get called per
How do I reload a UIView after viewDidLoad + viewWillAppear have already been called
I have a problem that the ViewWillAppear method for a UIView does not fire
I have seen a couple of articles about ViewWillAppear and ViewDidAppear not firing under
Do I have to do removeFromSuperview for each addSubview? For example, viewWillAppear is called
I have this code in the viewWillAppear of my initial View Controller if (howManyLeft
I have this code in my viewWillAppear method: sqlite3 *database; if (sqlite3_open([[self dataFilePath] UTF8String],

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.