0

我已经使用通知内容扩展实现了推送通知的自定义 UI。我添加了一个“查看”操作,如下所示

let navigateAction = UNNotificationAction(identifier: "ActionNotification", title: "View", options: [])  

let deafultCategory = UNNotificationCategory(identifier:
    "myNotifService", actions: [navigateAction], intentIdentifiers:[], options: [])

现在,在 Content Extension 的类 - NotificationViewController

func didReceive(_ response: UNNotificationResponse, completionHandler completion:(UNNotificationContentExtensionResponseOption) -> Void) {
   if response.actionIdentifier == "ActionNotification" {
       // HERE I NEED TO NAVIGATE TO SPECIFIC VIEW CONTROLLER
   }
   completion(.dismiss)
}

每当我单击“查看”按钮时,都会触发上述功能,但我需要从此处导航到特定屏幕。请帮忙。

提前致谢。

4

1 回答 1

0

快速尝试

let viewController = MyViewController(nibName: "MyNextViewController", bundle: nil)
self.navigationController?.pushViewController(viewController, animated: true)

或正常过渡

    next:MyViewController = storyboard?.instantiateViewControllerWithIdentifier("MyViewViewController") as!  MyViewViewController  
    self.navigationController?.pushViewController(next, animated: true)

对于objective-c试试

试试这个答案

于 2019-09-18T06:53:58.160 回答