Я реализовал пример из https://github.com/awslabs/aws-sdk-ios-samples/blob/master/CognitoYourUserPools-Sample/Swift/CognitoYourUserPoolsSample/MFAViewController.swift следующим образом:
import Foundation
import UIKit
import AWSMobileClient
import AWSCognitoIdentityProvider
class MFAModalViewController: UIViewController {
@IBOutlet weak var messageLabel: UILabel!
@IBOutlet var backgroundView: UIView!
@IBOutlet weak var boxView: UIView!
@IBOutlet weak var mfaTextField: UITextField!
public var message: String?
var mfaCompletionSource: AWSTaskCompletionSource<NSString>?
@IBAction func mfaTextFieldChanged(_ sender: Any) {
if let mfaCode = mfaTextField.text, mfaCode.count == 6 {
self.mfaCompletionSource?.set(result: NSString(string: mfaCode))
}
}
override func viewDidLoad()
{
super.viewDidLoad()
if let message = message {
messageLabel.text = message
}
}
}
extension MFAModalViewController: AWSCognitoIdentityMultiFactorAuthentication {
func getCode(_ authenticationInput: AWSCognitoIdentityMultifactorAuthenticationInput, mfaCodeCompletionSource: AWSTaskCompletionSource<NSString>) {
hud.dismiss()
self.mfaCompletionSource = mfaCodeCompletionSource
}
func didCompleteMultifactorAuthenticationStepWithError(_ error: Error?) {
...
}
}
Однако после установки для AWSTaskComplettionSource введенного кода MFA я никогда не получаю обратный вызов метода didCompleteMultifactorAuthenticationStepWithError в делегате AWSCognitoIdentityMultiFactorAuthentication.
Есть мысли, в чем может заключаться мое упущение?