嗨,我在 iOS 中使用 AWS Mobile hub,我遵循了 aut with cognito 的介绍。它说我必须从示例中导入用户池文件。我这样做了,但这会给我一个错误:
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()
})
}
}
}
错误:
类型“SignInViewController”不符合协议“AWSCognitoIdentityPasswordAuthentication”
还:
协议需要函数 'getDetails(_:passwordAuthenticationCompletionSource:)' 类型为 '(AWSCognitoIdentityPasswordAuthenticationInput, AWSTaskCompletionSource) -> Void'; 你想添加一个存根吗?(AWSCognitoIdentityProvider.AWSCognitoIdentityPasswordAuthentication)
和:
候选人的类型不匹配'(AWSCognitoIdentityPasswordAuthenticationInput, AWSTaskCompletionSource) -> ()'