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

  • Home
  • SEARCH
  • 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 7964613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T05:55:57+00:00 2026-06-04T05:55:57+00:00

Hi I was doing some testing earlier and my app was running just fine.

  • 0

Hi I was doing some testing earlier and my app was running just fine. I wanted to do some more testing so I decided to remove the app from my device and then reinstall it by running.

Well now for some reason I get to the stage where my splash screen shows up and then it crashes and I get the error:

 Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[__NSArrayI objectAtIndex:]: index 3 beyond bounds [0 .. 2]'

This obviously means theres an array out of bounds correct? But why now and how can I found out where and what view controller this is happening on? How could it run before and now all of a sudden when I try reinstalling the app through running it again I get this error?

Thanks

EDIT
The error is with the array in the following code

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {  

  exploreViewController *view1 = [[exploreViewController alloc] initWithNibName:@"exploreViewController" bundle:nil];
view1.title= @"Explore";

Upcoming *view2 = [[Upcoming alloc] initWithNibName:@"Upcoming" bundle:nil];
view2.title = @"Upcoming";

calcViewController *view3 = [[calcViewController alloc] initWithNibName:@"calcViewController" bundle:nil];
view3.title = @"Calc";

UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:view1];
UINavigationController *nav2 = [[UINavigationController alloc] initWithRootViewController:view2];
UINavigationController *nav3 = [[UINavigationController alloc] initWithRootViewController:view3];

self.tabBarController = [[[UITabBarController alloc] init] autorelease];
self.tabBarController.viewControllers = [NSArray arrayWithObjects:nav1,nav2,nav3,nil];
self.tabBarItem = [[[UITabBarItem alloc] init] autorelease];

NSArray *tabBarItems = self.tabBarController.tabBar.items; 
UIImage *tab1 = [UIImage imageNamed:@"85-trophy.png"]; 
UIImage *tab2 = [UIImage imageNamed:@"12-eye.png"]; 
UIImage *tab3 = [UIImage imageNamed:@"237-key.png"];

NSArray *tabBarImages = [[[NSArray alloc] initWithObjects:tab1, tab2, tab3,nil]autorelease]; 
NSInteger tabBarItemCounter; 
for (tabBarItemCounter = 0; tabBarItemCounter < [tabBarItems count]; tabBarItemCounter++) 
{ 
    tabBarItem = [tabBarItems objectAtIndex:tabBarItemCounter]; 
    tabBarItem.image = [tabBarImages objectAtIndex:tabBarItemCounter]; 
} 
  • 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-04T05:55:58+00:00Added an answer on June 4, 2026 at 5:55 am

    Well, the reason for this crash is the following:
    You are adding five items to your tabBar (nav1, nav2, nav3, nav4, nav6), but you only have three images for your tabs (tab1, tab2, tab3). So when the for loop reaches the fourth tab it crashes because tabBarImages only contains three objects.

    Apart from that your code looks a bit messy – which could be the reason for not seeing the error on first sight.

    // edit

    You are complicating things – just try the following piece of code

    UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:__your_viewController__];
    nav1.title = @"Explore";
    nav1.tabBarItem.image = [UIImage imageNamed:@"85-trophy.png"];
    
    UINavigationController *nav2 = [[UINavigationController alloc] initWithRootViewController:__your_viewController__];
    nav2.title = @"Upcoming";
    nav2.tabBarItem.image = [UIImage imageNamed:@"12-eye.png"];
    
    UINavigationController *nav3 = [[UINavigationController alloc] initWithRootViewController:__your_viewController__];
    nav3.title = @"Calc";
    nav3.tabBarItem.image = [UIImage imageNamed:@"237-key.png"];
    
    UITabBarController *tabBarController = [[UITabBarController alloc] init];    
    [tabBarController setViewControllers:[NSArray arrayWithObjects:nav1, nav2, nav3, nil]];
    
    [nav1 release];
    [nav2 release];
    [nav3 release];
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am doing some initial testing for a Rails app which will be deployed
I've just started doing some real-world performance testing on my Fluent NHibernate / SQLite
I was doing some testing and debugging of my Iphone app today and encountered
I'm just doing some testing with this, and I cant figure out if I
I am doing some testing in my iPhone app and I get this error:
Just doing some testing/prototyping with ClickOnce. Does anyone know why I can publish with
I am doing some performance testing on a SQL sproc and just want to
I was just doing some testing with YSlow and it's telling me: Grade F
I just did a push to Heroku and tried doing some testing by adding
I'm doing some functional testing in my Symfony2 app, and want to assert controller

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.