作者:小文662502914775 | 来源:互联网 | 2023-02-10 15:07
print语句在通知内容扩展中不起作用,虽然我能够修改Label文本和其他字段,下面是我的代码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 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" )
}
|
}
1> 小智..:
这里指出的以下步骤对我有用:
运行包含扩展程序的应用程序后,
在扩展中设置断点
选择Debug/Attach to Process by PID或name
输入扩展目标的名称
触发推送通知
扩展中的断点需要永远触发.耐心,最终你的断点将受到打击
每次通过Xcode重启应用程序时都必须这样做.