0
votes

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

        })
    }
1
try just error in - Leo Dabus
The NSError -> Error transition should be explained in the Xcode 8 release notes. - Martin R
@LeoDabus like this? completionHandler: { (error: error in) - Marc Fletcher
completionHandler: { 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

1 Answers

0
votes

NSError has turned into just Error.