I am having problem in pushing ViewController from AppDelegate when user pressed the Notification
Below is my code, but this code Crashes because the navigationController is nil
func application(application: UIApplication, didReceiveLocalNotification notification: UILocalNotification) {
var rootViewController = self.window!.rootViewController;
let customDetailsViewController = CustomDetailsViewController();
rootViewController?.navigationController!.pushViewController(customDetailsViewController, animated: true);
}
Any idea? Thank you!!
If your navigation controller is nil, then your rootViewController (the one with the arrow in your Storyboard) is not inside a NavigationController. Can you post a screenshot of the relevant part of your Storyboard?
EDIT :
As you are using RESideController , you'll have a RootViewController not connected to anything in your Storyboard. That RootViewController conforms to ``protocol and you have some code like:
@implementation FASRootViewController
- (void)awakeFromNib
{
self.menuPreferredStatusBarStyle = UIStatusBarStyleLightContent;
self.scaleContentView = NO;
self.scaleMenuView = NO;
self.panGestureEnabled = YES;
self.contentViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"contentViewController"];
self.rightMenuViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"rightMenuViewController"];
self.delegate = (id<RESideMenuDelegate>)self.rightMenuViewController;
}
To "launch" your View controllers your need to add a identifier in the Storyboard
Also, this View Controller should be a UINavigationController (not your first "content" view controller)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.