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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:00:46+00:00 2026-06-12T17:00:46+00:00

-(void)applicationDidFinishLaunching:(UIApplication *)application{ [[[self.window.rootViewController.tabBarController.viewControllers objectAtIndex:1] tabBarItem]setBadgeValue:@1]; } I use storyboard for UI and want to

  • 0
-(void)applicationDidFinishLaunching:(UIApplication *)application{

    [[[self.window.rootViewController.tabBarController.viewControllers objectAtIndex:1] tabBarItem]setBadgeValue:@"1"];
}

I use storyboard for UI and want to set notifications number for one of the tabbar items, but it seems that I do something wrong.

What is wrong with this code, why I don’t see the notification in the tabbar item?

Thanks in advance.

ANSWER:

FROM APPDELEGATE:
     UITabBarController *tabController = self.window.rootViewController;
        UIViewController *requiredViewController = [tabController.viewControllers objectAtIndex:1];
        UITabBarItem *item = requiredViewController.tabBarItem;
        [item setBadgeValue:@"1"];
  • 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-12T17:00:47+00:00Added an answer on June 12, 2026 at 5:00 pm

    Why is it all on one line?

    Break it down into a few smaller steps, set a breakpoint on step one and walk through the code checking to see if what you expect is happening on each line.

    UIViewController *rootController = self.window.rootViewController;
    UITabBarController *tabController = rootController.tabBarController;
    UIViewController *requiredViewController = [tabController.viewControllers objectAtIndex:1];
    UITabBarItem *item = requiredViewController.tabBarItem;
    [item setBadgeValue:@"1"];
    

    I suspect that one of your properties is nil – this is usually the cause of ‘why does my method fail without any warning or error` type bugs.

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

Sidebar

Related Questions

I have the following Code in my XMLAppDelegate.m file: - (void)applicationDidFinishLaunching:(UIApplication *)application { [self.window
- (void) applicationDidFinishLaunching:(UIApplication *)application { //set up main loop [NSTimer scheduledTimerWithTimeInterval:0.033 target:self selector:@selector(gameLoop:) userInfo:nil
- (void)applicationDidFinishLaunching:(UIApplication *)application { // Create the navigation and view controllers RootViewController *rootViewController =
MoviePlayerAppDelegate.m - (void)applicationDidFinishLaunching:(UIApplication *)application { window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; viewController =
This is unmodified code from Apple's iPhone 'Utility Aplication' template: - (void)applicationDidFinishLaunching:(UIApplication *)application {
InterfaceBuilder generates this method for me in fooAppDelegate.m: - (void)applicationDidFinishLaunching:(UIApplication *)application { // Override
- (void)fadeOutSplash { UIImageView *splash = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@Default-Landscape~ipad.png]]; [self.window.rootViewController.view addSubview:splash]; // <--
here is code - (void)applicationDidFinishLaunching:(UIApplication *)application { NSBundle *bundle = [NSBundle mainBundle]; NSString *moviePath
how do i add a navigationViewController to a UIViewController? - (void)applicationDidFinishLaunching:(UIApplication *)application { loginViewController
I'm doing the fourth assignment on the Stanford Iphone Dev Course. - (void)applicationDidFinishLaunching:(UIApplication *)application

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.