Hi im using AWS Mobile hub in iOS i followed the introductions to aut with cognito. It says I have to import the user pool files from the sample. I did so, but this throws me an error:
extension SignInViewController: AWSCognitoIdentityPasswordAuthentication {
func getDetails(_ authenticationInput: AWSCognitoIdentityPasswordAuthenticationInput, passwordAuthenticationCompletionSource: AWSTaskCompletionSource<AnyObject>) {
self.passwordAuthenticationCompletion = passwordAuthenticationCompletionSource
}
func didCompleteStepWithError(_ error: Error?) {
if let error = error {
DispatchQueue.main.async(execute: {
UIAlertView(title: "ERROR",
message: error.localizedDescription,
delegate: nil,
cancelButtonTitle: "Ok").show()
})
}
}
}
Errors:
Type 'SignInViewController' does not conform to protocol 'AWSCognitoIdentityPasswordAuthentication'
Also:
Protocol requires function 'getDetails(_:passwordAuthenticationCompletionSource:)' with type '(AWSCognitoIdentityPasswordAuthenticationInput, AWSTaskCompletionSource) -> Void'; do you want to add a stub? (AWSCognitoIdentityProvider.AWSCognitoIdentityPasswordAuthentication)
and:
Candidate has non-matching type '(AWSCognitoIdentityPasswordAuthenticationInput, AWSTaskCompletionSource) -> ()'
According to the docs, any class conforming to
AWSCognitoIdentityPasswordAuthentication
should implement :You don't implement them, hence the error.
EDIT Yes, you're right, the function signatures changed in Swift 3 (see here).
They should be like this :
Looks like your version of the first func is slightly different.