我正在实现
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: () -> Void) {
但是我从编译器收到“几乎匹配可选要求”的警告。我的声明有什么问题?我直接从文档中复制了它!
最佳答案
这是@escaping
属性。它没有显示在文档中。但它显示在页眉中。这就是复制的地方!这是正确的声明:
func userNotificationCenter(_ center: UNUserNotificationCenter,
didReceive response: UNNotificationResponse,
withCompletionHandler completionHandler: @escaping () -> Void) {
关于ios - UNUserNotificationCenterDelegate 委托(delegate)方法 "nearly matches optional requirement",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39515899/