I am trying a basic message extension tutorial in xcode, and while my code is verbatim from the tutorial, the build keeps failing with the following error:
Cannot convert value of type '(NSError?) -> ()' to expected argument type '((Error?) -> Void)?'
Obviously, I'd like this fixed, but as someone very new to Swift, I'd also appreciate an explanation as to why.
@IBAction func sendMessageButtonPressed() {
self.activeConversation?.insertText("lorem ips!", completionHandler: { (error:
NSError?) in
})
}
error in- Leo DabuscompletionHandler: { error in // your code }You don't need to specify the type. It is inferred. Just choose any name for your error variable - Leo Dabus