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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T15:33:58+00:00 2026-05-22T15:33:58+00:00

In application:didFinishLaunchingWithOptions: I initialize a UINavigationController . Later, I add the UINavigationController to the

  • 0

In application:didFinishLaunchingWithOptions: I initialize a UINavigationController. Later, I add the UINavigationController to the window:

[self.window addSubview:navigationController.view]

This all works fine. Now I added local notifications to my app and when the user responds to one, I would like to present a UIViewController. So I thought I could override application:didReceiveLocalNotification: and in there, use my navigationController:

[navigationController pushViewController:someVC animated:YES];

However, this does not work. I did some debugging and noticed that while navigationController is not nil, navigationController.view has no superview, so I assume it is not being displayed.

So, my question is: where should I push my UIViewController so that it gets displayed?

  • 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-22T15:33:58+00:00Added an answer on May 22, 2026 at 3:33 pm

    In your AppDelegate.h add this:

    //Under where you have <UIKit/UIKit.h>
    extern NSString *localReceived;
    

    In your AppDelegate.m add this:

    //All the way on top where you import your viewControllers
    NSString *localReceived = @"localReceived";
    

    In your AppDelegate.m in the - (void)application:(UIApplication *)app didReceiveLocalNotification:(UILocalNotification *)localNotification;
    method add this:

            [[NSNotificationCenter defaultCenter] postNotificationName:localReceived object:self];
    

    Make sure that your viewController is a navigationController

    If it’s not, do the following — Add this piece of code to your - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions:

        UINavigationController *nvcontrol = [[UINavigationController alloc] initWithRootViewController:viewController];
    
    [window addSubview:nvcontrol.view];
    [window makeKeyAndVisible];
    

    Now — in your viewController.m add this to your -viewDidLoad function

        [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(localAction) name:localReceived object:nil];
    

    Make a -(void) localAction and in that method add your navigationController code to push to the next View Controller!

    Hope that works for you. Works like a charm for me

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

Sidebar

Related Questions

In application:didFinishLaunchingWithOptions: I'm adding a split view: [self.window addSubview:splitViewController.view]; [self.window makeKeyAndVisible]; splitViewController comes from
(BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { [self.window addSubview:rootController.view]; [self.window makeKeyAndVisible]; [[controlfile alloc]scedule1]; return YES; }
Application has an auxiliary thread. This thread is not meant to run all the
I have the starter point of my application this window (white background): - (BOOL)application:(UIApplication
I create a new View-based Application project and modify the didFinishLaunchingWithOptions: method as follow.
I create a new View-based Application project and modify the didFinishLaunchingWithOptions: method as follow.
Does method -application:didFinishLaunchingWithOptions: run in iOS 2.0? -application:didFinishLaunchingWithOptions: is a delegate method in ios3.0
I have implemented UIApplicationDelegate's application:didFinishLaunchingWithOptions: and application:handleOpenURL: according to specification, i.e., application:didFinishLaunchingWithOptions: returns YES
I need to make multiple asynchronous service calls in the application:didFinishLaunchingWithOptions: method from my
this is my first iPhone application and I'm using JSON framework to decode JSON

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.