I have a TabBarController as the App entry point. After a receiving Local-Notification, I want to display a specific UIViewController.
Depending on the actual App-state (frontmost / not-frontmost, not running), I am able to catch the push notification by e.g. application:willFinishLaunchingWithOptions:
or application:didReceiveLocalNotification:
in the appdelegate.
However, I am not able to manage to open a specific UIViewController at that point (that by the way is not one of the tabbarcontroller.selectedIndexes
) .
I tried various things, e.g. presentViewController
:
Today*today = [[Today alloc] init];
[[[[[UIApplication sharedApplication] delegate] window] rootViewController] presentViewController:today animated:NO completion:nil];
leaving to Error:
Warning: Attempt to present <Today: 0x7fcb91ed5a40> on <UITabBarController: 0x7fcb91c79810> whose view is not in the window hierarchy!
Posts here indicate to use [self.window makeKeyAndVisible];
before calling presentViewController
: Same error!
Further posts [ thisOne ] indicate that this error can be omitted by putting presentViewController
in viewDidAppear:
however, this is not possible in the appdelegate, where i catch the local notification...
Even calling a segue is not possible, as it seems that no View Controller has been loaded at this point already...
Some people indicating that calling a UIViewController from AppDelegate is not possible at all, is this right ?
I am out of ideas, do you have any how to do that.... ?!?