嗨,我在iOS中使用AWS,我遵循了aut的介绍。它说我必须从示例中导入用户池文件。我这样做了,但这给我带来了一个错误:
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) -> ()‘
发布于 2017-01-04 13:25:11
根据文档,任何符合AWSCognitoIdentityPasswordAuthentication的类都应该实现:
– getPasswordAuthenticationDetails:passwordAuthenticationCompletionSource
– didCompletePasswordAuthenticationStepWithError您没有实现它们,因此出现了错误。
编辑是的,您是对的,函数签名在Swift 3中更改了(参见这里)。
他们应该是这样:
func getDetails(_ authenticationInput: AWSCognitoIdentityPasswordAuthenticationInput, passwordAuthenticationCompletionSource: AWSTaskCompletionSource<AWSCognitoIdentityPasswordAuthenticationDetails>)
func didCompleteStepWithError(_ error: Error?)看起来您的第一个功能的版本略有不同。
https://stackoverflow.com/questions/41464046
复制相似问题