Xcode 8 Warning “Instance method nearly matches optional requirement”

后端 未结 10 1548
情深已故
情深已故 2020-12-03 05:01

I converted my (macOS) project to Swift 3 in Xcode 8 and I get the following warnings with several delegate methods I implement in swift classes:

Instance me         


        
10条回答
  •  猫巷女王i
    2020-12-03 05:28

    Just to add clarification to this rather over complicated workaround: can anyone see why the below is not firing/working when the action is being taken?

    extension AppDelegate: UNUserNotificationCenterDelegate {
        @objc(userNotificationCenter:didReceiveNotificationResponse:withCompletionHandler:)
        func userNotificationCenter(_ center: UNUserNotificationCenter, didReceive response: UNNotificationResponse, withCompletionHandler completionHandler: @escaping () -> Void) {
            print("RESPONSE FROM NOTIFICATION!")
    
            switch response.actionIdentifier {
            case "reply":
                print("Reply action received!")
            case "ignore":
                print("Ignore action received!")
            default: print("Error - Unknown action received!")
                break
            }
        }
    }
    

提交回复
热议问题