2017-01-04 8 views
0

こんにちは、iOS iでAWS Mobile hubを使用しています。私はサンプルからユーザープールファイルをインポートする必要があると言います。私はそのようにしたが、これは私にエラーがスローされます:AWS iOS Swift 3 Cognito Typeがプロトコルに準拠していません

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() 
      }) 
     } 
    } 
} 

エラー:

Type 'SignInViewController' does not conform to protocol 'AWSCognitoIdentityPasswordAuthentication'

また:

Protocol requires function 'getDetails(_:passwordAuthenticationCompletionSource:)' with type '(AWSCognitoIdentityPasswordAuthenticationInput, AWSTaskCompletionSource) -> Void'; do you want to add a stub? (AWSCognitoIdentityProvider.AWSCognitoIdentityPasswordAuthentication)

と:

Candidate has non-matching type '(AWSCognitoIdentityPasswordAuthenticationInput, AWSTaskCompletionSource) ->()'

答えて

1

docsによると、に準ずるクラスは実装する必要があります。

– getPasswordAuthenticationDetails:passwordAuthenticationCompletionSource 
– didCompletePasswordAuthenticationStepWithError 

これは実装されていないため、エラーです。

EDIT はい、あなたは正しい、スウィフト3で変更関数のシグネチャ(hereを参照してください)。

彼らはこのようにする必要があります:最初のFUNCのバージョンが若干異なっているよう

func getDetails(_ authenticationInput: AWSCognitoIdentityPasswordAuthenticationInput, passwordAuthenticationCompletionSource: AWSTaskCompletionSource<AWSCognitoIdentityPasswordAuthenticationDetails>) 
func didCompleteStepWithError(_ error: Error?) 

が見えます。

+0

これらは実装されており、Swift 3で名前が変更されました。 –

+0

編集してエラー情報を追加しました。 –

関連する問題