【问题标题】:UNUserNotificationCenterDelegate didReceive response for Local Notifications not called when app is not running应用程序未运行时未调用本地通知的 UNUserNotificationCenterDelegate didReceive 响应
【发布时间】:2018-01-04 11:11:05
【问题描述】:

我正在尝试将新的 UserNotifications 框架用于本地通知。单击/打开通知时,我将用户重定向到不同的视图控制器。 UNUserNotificationCenterDelegate didReceive 方法没有正确处理通知。

当通知在前台,然后被点击时,它会重定向到右边的viewcontroller,但是,当应用程序关闭并打开通知时,应用程序会启动,但是,主viewcontroller会显示出来.

【问题讨论】:

  • 检查启动选项数据

标签: ios swift unusernotificationcenter usernotifications


【解决方案1】:

问题实际上不在于didReceive,而是在于视图控制器的转换方式,因为方法在完成之前返回。

我正在以编程方式模拟正常的用户流程。问题在于 tableview:didselectRowAt 在其内部的 performSegue 方法执行之前返回。

我最终改为手动加载 VC,并显式调用 UInavigationController:pushViewController(vc:animated:) 将它们推送到导航堆栈上。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-10-05
    • 2013-10-08
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多