在iOS 13上撤消刷新令牌后,AWS Cognito身份验证崩溃

我有一个iOS应用,该应用基于awslabs aws-sdk-ios-samples代码使用AWS Cognito进行用户池身份验证。

通常它可以正常工作,但是从iOS 13.1.2开始,每当刷新令牌被撤消时,尝试加载导航控制器时应用程序就会崩溃。

似乎在后台线程中正在调用AWSCognito startPasswordauthentication函数,但仅当登录尝试返回时 {"__type":"NotAuthorizedException","message":"Refresh Token has been revoked"}

将整个startPasswordauthentication函数放入Dispatchqueue.main.async {}不会让我编译。

func startPasswordauthentication() -> AWSCognitoIdentityPasswordauthentication {
         print("Starting Cognito Password Authentication")


         if (self.navigationController?.restorationIdentifier != "signinController") {

                 self.navigationController = self.authstoryboard?.instantiateViewController(withIdentifier: "signinController") as? UINavigationController
             }



         if (self.signInViewController == nil) {
             self.signInViewController = self.navigationController?.viewControllers[0] as? SignInViewController

         }

         DispatchQueue.main.async {

             self.window?.rootViewController = self.navigationController

             self.navigationController!.poptoRootViewController(animated: true)
             if (!self.navigationController!.isViewLoaded
                 || self.navigationController!.view.window == nil) {
                 self.window?.rootViewController?.present(self.navigationController!,animated: true,completion: nil)
             }
         }
         return self.signInViewController!
     }

崩溃转储返回

Main Thread Checker: UI API called on a background thread: -[uiactivityIndicatorView initWithactivityIndicatorStyle:]
PID: 5625,TID: 1837740,Thread name: (none),Queue name: NSOperationQueue 0x145e7cff0 (QOS: UNSPECIFIED),QoS: 0
Backtrace:
4   iParcelBox                          0x000000010489df64 $sSo23uiactivityIndicatorViewC5styleABSo0abC5StyleV_tcfcTO + 40
5   iParcelBox                          0x0000000104894870 $sSo23uiactivityIndicatorViewC5styleABSo0abC5StyleV_tcfC + 52
6   iParcelBox                          0x0000000104894c5c $s10iParcelBox11ProgressHUDC4textACSS_tcfc + 220
7   iParcelBox                          0x0000000104894b70 $s10iParcelBox11ProgressHUDC4textACSS_tcfC + 68
8   iParcelBox                          0x0000000104730d30 $s10iParcelBox20SignInViewControllerC5coderACSgSo7NSCoderC_tcfc + 992
9   iParcelBox                          0x0000000104730ed0 $s10iParcelBox20SignInViewControllerC5coderACSgSo7NSCoderC_tcfcTo + 60
10  UIKitCore                           0x00000001c708e108 B856439D-6DF2-38FE-9689-E4C590AF1442 + 7123208
11  UIFoundation                        0x00000001c694d300 601DB17B-4B17-30A9-962A-D27A531F470C + 447232
12  UIFoundation                        0x00000001c694d534 601DB17B-4B17-30A9-962A-D27A531F470C + 447796
13  UIFoundation                        0x00000001c68e7fe4 601DB17B-4B17-30A9-962A-D27A531F470C + 32740
14  UIKitCore                           0x00000001c708d3fc B856439D-6DF2-38FE-9689-E4C590AF1442 + 7119868
15  UIKitCore                           0x00000001c6dbd260 B856439D-6DF2-38FE-9689-E4C590AF1442 + 4170336
16  UIKitCore                           0x00000001c6d17698 B856439D-6DF2-38FE-9689-E4C590AF1442 + 3491480
17  UIKitCore                           0x00000001c708e108 B856439D-6DF2-38FE-9689-E4C590AF1442 + 7123208
18  UIFoundation                        0x00000001c694d300 601DB17B-4B17-30A9-962A-D27A531F470C + 447232
19  UIFoundation                        0x00000001c68e7fe4 601DB17B-4B17-30A9-962A-D27A531F470C + 32740
20  UIKitCore                           0x00000001c70922b4 B856439D-6DF2-38FE-9689-E4C590AF1442 + 7140020
21  UIFoundation                        0x00000001c694d300 601DB17B-4B17-30A9-962A-D27A531F470C + 447232
22  UIFoundation                        0x00000001c694d534 601DB17B-4B17-30A9-962A-D27A531F470C + 447796
23  UIFoundation                        0x00000001c68e7fe4 601DB17B-4B17-30A9-962A-D27A531F470C + 32740
24  UIKitCore                           0x00000001c708d1e0 B856439D-6DF2-38FE-9689-E4C590AF1442 + 7119328
25  UIKitCore                           0x00000001c708fe18 B856439D-6DF2-38FE-9689-E4C590AF1442 + 7130648
26  UIKitCore                           0x00000001c7562054 B856439D-6DF2-38FE-9689-E4C590AF1442 + 12185684
27  iParcelBox                          0x000000010489a20c $s10iParcelBox11AppDelegateC27startPasswordauthenticationSo018AWSCognitoIdentityfG0_pyF + 1684
28  iParcelBox                          0x000000010489b63c $s10iParcelBox11AppDelegateC27startPasswordauthenticationSo018AWSCognitoIdentityfG0_pyFTo + 40
29  AWSCognitoIdentityProvider          0x00000001085a63fc -[AWSCognitoIdentityUser interactiveAuth] + 1312
30  AWSCognitoIdentityProvider          0x000000010859fd7c __36-[AWSCognitoIdentityUser getSession]_block_invoke + 224
31  AWSCore                             0x0000000108875708 __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke + 108
32  AWSCore                             0x000000010881e444 __30+[AWSExecutor defaultExecutor]_block_invoke_2 + 164
33  AWSCore                             0x000000010881ed0c -[AWSExecutor execute:] + 120
34  AWSCore                             0x0000000108875b7c __56-[AWSTask continueWithExecutor:block:cancellationToken:]_block_invoke.105 + 52
35  AWSCore                             0x000000010887515c -[AWSTask runContinuations] + 532
36  AWSCore                             0x0000000108874c28 -[AWSTask trySetError:] + 256
37  AWSCore                             0x0000000108876b78 -[AWSTaskCompletionSource setError:] + 112
38  AWSCore                          2019-11-09 08:13:24.078227+0000 iParcelBox[5625:1837740] [reports] Main Thread Checker: UI API called on a background thread: -[uiactivityIndicatorView initWithactivityIndicatorStyle:]
dwzjr 回答:在iOS 13上撤消刷新令牌后,AWS Cognito身份验证崩溃

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3133540.html

大家都在问