Notifications 无法调试ios 10通知中的通知内容扩展

Notifications 无法调试ios 10通知中的通知内容扩展,notifications,apple-push-notifications,ios10,Notifications,Apple Push Notifications,Ios10,print语句在通知内容扩展中不起作用,尽管我可以修改标签文本和其他字段,下面是我的代码 class NotificationViewController: UIViewController, UNNotificationContentExtension { @IBOutlet weak var label: UILabel! override func viewDidLoad() { super.viewDidLoad() print("inside viewDidLoa

print语句在通知内容扩展中不起作用,尽管我可以修改标签文本和其他字段,下面是我的代码

class NotificationViewController: UIViewController, UNNotificationContentExtension {


@IBOutlet weak var label: UILabel!

override func viewDidLoad() {
    super.viewDidLoad()
    print("inside viewDidLoad of notificationViewController")
}

func didReceive(_ notification: UNNotification) {
    self.label?.text = notification.request.content.body
    print("inside didReceive of notificationViewController")

}

}

以下步骤对我很有效:

运行包含扩展名的应用程序后

  • 在扩展中设置断点
  • 选择“按PID或名称调试/附加到进程”
  • 输入扩展目标的名称
  • 触发推送通知
  • 扩展中的断点需要很长时间才能触发。耐心点,最终你的断点会被击中
每次通过Xcode重新启动应用程序时,您都必须这样做


嘿,我的电脑在收到像这样的通知时崩溃了,你有什么想法吗?你知道触发断点的“永久”时间是多长吗?5分钟、10分钟还是1小时?