我正在尝试创建一个推送通知,该通知根据从推送获得的信息来确定要打开哪个视图。
我已经设法从推送中获取了信息,但是现在我正在努力地打开视图
查看其他堆栈溢出问题,我目前有以下问题:
应用程序委托完成加载:
//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 == "circles" {
var viewController = self.window?.rootViewController?.storyboard?.instantiateViewControllerWithIdentifier("Circles") as! UIViewController
self.window?.rootViewController = viewController
}
}
当前,这在var ViewController = self ...行上失败。