我正在创建一个应用程序,我在mac上反映我的Android通知,并从mac本身回复它们。我正在使用NSUsernotification
来做同样的事情。通知工作完美。当我点击回复按钮并输入文字时,有时notification.response
会在nil
代表中返回didActive notification
。任何人都可以帮我吗?
func userNotificationCenter(_ center: NSUserNotificationCenter, didActivate notification: NSUserNotification) {
if notification.activationType == NSUserNotification.ActivationType.replied {
print(notification.response) //This is nil sometimes. Not always
}
}