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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T17:03:54+00:00 2026-05-25T17:03:54+00:00

Ok, so I have the following: – (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { MainViewController *

  • 0

Ok, so I have the following:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
    MainViewController * tabBarController = [[MainViewController alloc] init];
    [self.window addSubview:tabBarController.view];
    [self.window makeKeyAndVisible];
    [tabBarController release];

    [application registerForRemoteNotificationTypes:UIRemoteNotificationTypeBadge|
     UIRemoteNotificationTypeAlert|
     UIRemoteNotificationTypeSound];

    return YES;

}

Here, MainViewController is just a subclass of a UITabBarController, and inside MainViewController’s viewDidLoad I have:

- (void)viewDidLoad
{
    [super viewDidLoad];

 NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:3];

MapViewController * map = [[MapViewController alloc] init];
    [localControllersArray addObject:map];

    //[localNavigationController release];
    [map release];


    ListViewController * voteSpot = [[ListViewController alloc] initWithTabBar];
    [localControllersArray addObject:voteSpot];

    //[localNavigationController release];
    [voteSpot release];


    ProfileViewController * profile = [[ProfileViewController alloc] initWithTabBar];
    [localControllersArray addObject:profile];

    //[localNavigationController release];
    [profile release];


    self.viewControllers = localControllersArray;
    [localControllersArray release];
}

and now what I can see is just:

enter image description here

Any idea why it is a white screen?

Here’s an example of my initWithTabBar:

-(id) initWithTabBar {
    if ([self init]) {
        self.navigationItem.title=@"Map";
    }
    return self;
}

Ignore the bottom tab bar momentarily (middle one missing), that does exactly what I want.. What I am confused is with the viewController associated with each tab, it has nothing on it, while in fact MapViewController has a MapView in it. When I click on any tab then it will crash (program received signal: EXC_BAD_ACCESS) at int retVal = UIApplicationMain(...)

UPDATE:

If you want to debug it, I’ve uploaded a sample code at git hub where you can download the whole project (it’s a simple test project, I promise)

  • 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-25T17:03:54+00:00Added an answer on May 25, 2026 at 5:03 pm

    You should be adding your controllers to the TabBarControllers viewControllers property. Like so:

    self.viewControllers = [NSArray arrayWithObjects:map, voteSpot, profile, nil];
    

    Edit: Sorry, I didn’t see that you already had that. However, depending on the actual problem, the above snippet could actually solve your problem.

    A few things:

    1. I can’t see the creation of your localControllersArray. Is it autoreleased or not?
    2. The error you’re getting indicates a memory problem (i.e. accessing a variable that has been freed). You can set NSZombieEnabled = YES in the build scheme to find exactly which variable is causing the problem.
    3. I personally like to create the view controllers in the app delegate and assign them there. There’s no reason (that I’m aware of) that it shouldn’t work in viewDidLoad, though.

    Edit 2:
    After looking at your project, I was able to get it up and running and showing your tab views by changing the applicationDidFinishLaunchingWithOptions method to look like this:

    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        BaseViewController * tabBarController = [[BaseViewController alloc] init];
    
        NSMutableArray *localControllersArray = [[NSMutableArray alloc] initWithCapacity:3];   
    
        //MapViewController * map = [[MapViewController alloc] init];
        //UINavigationController* mapNavController = [[[UINavigationController alloc]
        //                                              initWithRootViewController:map] autorelease];
        //[map release];
        //[localControllersArray addObject:mapNavController];
    
    
        ProfileViewController * profile = [[ProfileViewController alloc] init];
        [localControllersArray addObject:profile];
        [profile release];
    
        tabBarController.viewControllers = localControllersArray;
        [localControllersArray release];
    
        self.window.rootViewController = tabBarController;
        [self.window makeKeyAndVisible];
        [tabBarController release];
        return YES;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have following piece of code NSMutableArray *mutArray = [[NSMutableArray alloc] init]; [mutArray addObject:
Have following listener for keyboard ArrowDown event(it's key code is 40 ): window.onload =
I have following code: class EntityBase (object) : __entity__ = None def __init__ (self)
I have following code which works fine in iPhone application but in iPad I
I have following situation: I have loged user, standard authentication with DB table $authAdapter
I have following string String str = replace :) :) with some other string;
I have following foreach-loop: using System.IO; //... if (Directory.Exists(path)) { foreach(string strFile in Directory.GetFiles(path,
I have following situation. A main table and many other tables linked together with
I have following table structure: Table: Plant PlantID: Primary Key PlantName: String Table: Party
I Have following code: Controller: public ActionResult Step1() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public

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.