I just upgraded to Xcode 8 and am already getting errors which cause the build to fail. I'm very new to swift, please help.
What should I change this to? Thanks
UPDATE
Apart from this error i also got the following:
PFUser.logInWithUsername(inBackground: usernameTextField.text!, password: passwordTextField.text!, block: { (user, error) -> Void in
//self.activityIndicator.stopAnimating()
UIApplication.shared.endIgnoringInteractionEvents()
if user != nil {
self.launchDrawerMenu()
} else {
let convertedError = error! as NSError
//if let errorString = convertedError["error"] as? String {
errorMessage = errorString
}
self.displayAlert("Login failed", message: errorMessage)
}
})
for the // line I got "type NSError has no subscript members" error. I tried bridging it to NSError but it does not work this time. What should i do? thanks a lot
First of all, post the code (text) rather than a screenshot.
In Swift 3 NSError
has been replaced in many APIs with more generic Swift Error
protocol which has no userInfo
dictionary. Bridge cast the object to NSError
if let errorString = (error as? NSError)?.userInfo....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With