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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:46:29+00:00 2026-05-30T07:46:29+00:00

Just beginning iOS development and I am getting a crash on creating an UITabBarController

  • 0

Just beginning iOS development and I am getting a crash on creating an UITabBarController with a TableViewController in tab 1 (2nd tab).

Here is my code – AppDelegate.m:

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 
{
diseases = [NSMutableArray arrayWithCapacity:5];
        Disease *disease1 = [[Disease alloc] init];
        Disease *disease2 = [[Disease alloc] init];
        Disease *disease3 = [[Disease alloc] init];
        Disease *disease4 = [[Disease alloc] init];
        Disease *disease5 = [[Disease alloc] init];

        disease1.name = @"disease1";
        disease2.name = @"disease2";
        disease3.name = @"disease3";
        disease4.name = @"disease4";
        disease5.name = @"disease5";

        [diseases addObject:disease1];
        [diseases addObject:disease2];
        [diseases addObject:disease3];
        [diseases addObject:disease4];
        [diseases addObject:disease5];


UITabBarController *tabBarController = (UITabBarController *)self.window.rootViewController;

UINavigationController *navigationController = 
[[tabBarController viewControllers] objectAtIndex:0];

FirstViewController *firstViewController = [[FirstViewController alloc] initWithNibName:@"NormalBiopsy" bundle:nil];
firstViewController = [[tabBarController viewControllers] objectAtIndex:0];

DiseaseTableViewController *diseaseTableViewController = [[DiseaseTableViewController alloc] initWithNibName:@"DiseaseTableViewController" bundle:nil];
diseaseTableViewController = [[tabBarController viewControllers] objectAtIndex:1];

SecondViewController *secondViewController = [[SecondViewController alloc] 
                                              initWithNibName:@"TestYourSelf" bundle:nil];
secondViewController = [[tabBarController viewControllers] objectAtIndex:2];

ThirdViewController *thirdViewController = [[ThirdViewController alloc] initWithNibName:@"About" bundle:nil];
thirdViewController = [[tabBarController viewControllers] objectAtIndex:3];

// Override point for customization after application launch.
return YES;
}

This leads to a UITabBarController with a blank table in the TableView of the DiseaseTableViewController – because no data populated.
But if I do

diseaseTableViewController.diseases = diseases;

the app crashes with:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-                [UINavigationController setDiseases:]: unrecognized selector sent to instance

So I tried to add the diseaseTableViewController to the navigationController:

diseaseTableViewController = [[navigationController viewControllers] objectAtIndex:1];

Which causes:

    Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[FirstViewController viewControllers]: unrecognized selector sent to instance 

I tried populating the DiseaseTableViewController in that class implementation rather than the AppDelegate but ended with a blank table in the UI again.

Any ideas?

  • 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-30T07:46:30+00:00Added an answer on May 30, 2026 at 7:46 am

    I resolved this by leaving the original AppDelegate as is, and populating the data of DiseaseController.diseases in the viewDidLoad() kind of like what @Zhang mentioned

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

Sidebar

Related Questions

I am just beginning to get into desktop application development, and have chosen C#
I'm only really beginning IOS development but have a few years dev of ASP.net
I am just beginning with Hibernate Search. The code I am using to do
I'm just beginning with C++, so I'm looking some code to learn. I found
I'm just beginning a very simple pygame code that draws a green line on
I'm just beginning in scala and I'm converting some java code into scala and
Just beginning with iPhone development i seem to miss something fundamental. In a View
We are just beginning the process of looking for a source code control system.
I've just started with iOS 5 and got surprised from the beginning. Now the
I'm just beginning to have a look at Objective-C and Cocoa with a view

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.