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

问题描述 投票:0回答:1

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

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")
        
    }

}
notifications apple-push-notifications ios10
1个回答
18
投票

以下步骤指向here对我有用:

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

  • 在扩展中设置断点
  • 通过 PID 或名称选择调试/附加到进程
  • 输入扩展目标的名称
  • 触发推送通知
  • 扩展中的断点需要永远触发。要有耐心,最终你的断点会被击中

每次通过 Xcode 重新启动应用程序时,您都必须执行此操作。

最新问题
© www.soinside.com 2019 - 2024. All rights reserved.