无法调试 ios 10 通知中的通知内容扩展
Not able to debug notificaton content extension in ios 10 notification
打印语句在通知内容扩展中不起作用,虽然我可以修改标签文本和其他字段,下面是我的代码
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")
}
}
以下步骤指出 here 对我有用:
After running the app that contains the extension,
- Set your breakpoint in the extension
- Select Debug / Attach to Process by PID or name
- Enter the name of the extension target
- Trigger the push notification
- Breakpoints in extensions take forever to trigger. BE PATIENT, eventually your breakpoint will be hit
You will have to do this every time you restart your app via Xcode.
打印语句在通知内容扩展中不起作用,虽然我可以修改标签文本和其他字段,下面是我的代码
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")
}
}
以下步骤指出 here 对我有用:
After running the app that contains the extension,
- Set your breakpoint in the extension
- Select Debug / Attach to Process by PID or name
- Enter the name of the extension target
- Trigger the push notification
- Breakpoints in extensions take forever to trigger. BE PATIENT, eventually your breakpoint will be hit
You will have to do this every time you restart your app via Xcode.