【发布时间】:2020-09-13 23:32:09
【问题描述】:
我已经使用 AWS Amplify 实现了注册/登录功能,并使用我自己的 View 控制器而不是 Drop-in auth 快速实现。一旦我退出应用程序并重新启动它,问题就开始了。完成此操作后,用户不再登录。我已将记住设备设置为始终在用户池设置中。 有人遇到过这个问题吗? 这是我的功能,用户得到确认,除了记住用户之外一切正常
@objc func confirm(){
print("confirm pressed")
guard let verificationCode = verificationTextField.text else{
return
}
AWSMobileClient.default().confirmSignUp(username: username, confirmationCode: verificationCode) { (signUpResult, error) in
if let signUpResult = signUpResult{
switch(signUpResult.signUpConfirmationState){
case .confirmed:
AWSMobileClient.default().deviceOperations.updateStatus(remembered: true) { (result, error) in //This is where I try to save the users device
print("User is signed up and confirmed")
DispatchQueue.main.async {
let signedInTabBar = SignedInTabBarController()
self.view.window!.rootViewController = signedInTabBar
}
}
case .unconfirmed:
print("User is not confirmed and needs verification via \(signUpResult.codeDeliveryDetails!.deliveryMedium) sent at \(signUpResult.codeDeliveryDetails!.destination!)")
case.unknown:
print("Unexpected case")
}
}else if let error = error {
print("\(error.localizedDescription)")
}
}
}
【问题讨论】:
-
如果您使用其中一种 Web UI 登录方法,设备记忆功能将不起作用。 link
标签: swift amazon-web-services aws-amplify