NSUsernotification响应有时返回nil

时间:2017-01-17 09:56:02

标签: android ios macos swift3

我正在创建一个应用程序,我在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
    }
}

0 个答案:

没有答案