I have an app which currently uses push notifications and we have started trying to open specific pages of the app from JSON pushes.
This is the code for one of possible pages to open:
//Extract the notification data
if let notificationPayload = launchOptions?[UIApplicationLaunchOptionsRemoteNotificationKey] as? NSDictionary {
// Get which page to open
let viewload = notificationPayload["view"] as? NSString
let storyBoard : UIStoryboard = UIStoryboard(name: "Main", bundle:nil)
//Load correct view
if viewload == "videos" {
let mainStoryboard : UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let initialViewController : UIViewController = mainStoryboard.instantiateViewControllerWithIdentifier("Videos") as! UIViewController
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window?.rootViewController = initialViewController
self.window?.makeKeyAndVisible()
}
}
The problem is that doing this skips the viewcontroller that allows the burger menu to be opened at the side.
Is there a way to open the burger menu controller and load the correct view from the push?
If you need more information let me know, I'll post updates as needed