我正在与"Unauthenticated access is not supported for this identity pool."
我的 Swift iOS 应用程序中的 AWS Cognito 问题作斗争。我之前使用 Firebase 进行身份验证和存储,但出于此问题范围之外的原因,我决定迁移到 AWS Mobile Hud。
我使用/已设置:
- Amazon Mobile Hud 提供所有服务
- AWS Cognito 通过 Mobile Hud 进行身份验证/身份验证
- Facebook 作为身份提供者已激活
- AWS DynamoDB 在控制台中激活但尚未使用
- AWS S3 在控制台中激活但尚未使用
我下载了为我的项目生成的示例应用程序并运行它。
通过示例应用程序,我能够通过 Facebook 和 Cognito 成功注册/验证。
什么有效?:我已将 AWS 的所有 SDK/框架集成到我的项目中,并且能够成功构建(注意:所有 AWS 框架都是通过 cocoapods 集成的,除了“AWSMobileHubHelper”作为静态框架)。
我可以构建应用程序并打开它
什么不起作用?:应用程序在打开后立即崩溃,并显示以下崩溃日志:
2017-02-13 15:43:49.825 dates[19823:463495] AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
Connection = "keep-alive";
"Content-Length" = 111;
"Content-Type" = "application/x-amz-json-1.1";
Date = "Mon, 13 Feb 2017 14:43:49 GMT";
"x-amzn-ErrorMessage" = "Unauthenticated access is not supported for this identity pool.";
"x-amzn-ErrorType" = "NotAuthorizedException:";
"x-amzn-RequestId" = "d4f8ec82-f1fa-11e6-bd81-3727ca129d86";
}
2017-02-13 15:43:49.826 dates[19823:463495] AWSiOSSDK v2.5.0 [Debug] AWSURLResponseSerialization.m line:63 | -[AWSJSONResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body:
{"__type":"NotAuthorizedException","message":"Unauthenticated access is not supported for this identity pool."}
2017-02-13 15:43:49.826 dates[19823:463495] AWSiOSSDK v2.5.0 [Error] AWSIdentityProvider.m line:309 | __52-[AWSCognitoCredentialsProviderHelper getIdentityId]_block_invoke.255 | GetId failed. Error is [Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=8 "(null)" UserInfo={__type=NotAuthorizedException, message=Unauthenticated access is not supported for this identity pool.}]
2017-02-13 15:43:49.826 dates[19823:463452] AWSiOSSDK v2.5.0 [Error] AWSCredentialsProvider.m line:565 | __44-[AWSCognitoCredentialsProvider credentials]_block_invoke.349 | Unable to refresh. Error is [Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=8 "(null)" UserInfo={__type=NotAuthorizedException, message=Unauthenticated access is not supported for this identity pool.}]
2017-02-13 15:43:49.827 dates[19823:463379] -[AWSTask exception]: unrecognized selector sent to instance 0x60800027af00
2017-02-13 15:43:49.828 dates[19823:463379] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AWSTask exception]: unrecognized selector sent to instance 0x60800027af00'
*** First throw call stack:
(
0 CoreFoundation 0x0000000112abcd4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000011251e21e objc_exception_throw + 48
2 CoreFoundation 0x0000000112b2cf04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x0000000112a42005 ___forwarding___ + 1013
4 CoreFoundation 0x0000000112a41b88 _CF_forwarding_prep_0 + 120
5 dates 0x000000010ef4e917 __35-[AWSIdentityManager completeLogin]_block_invoke_2 + 263
6 libdispatch.dylib 0x00000001150f4978 _dispatch_call_block_and_release + 12
7 libdispatch.dylib 0x000000011511e0cd _dispatch_client_callout + 8
8 libdispatch.dylib 0x00000001150fe8a4 _dispatch_main_queue_callback_4CF + 406
9 CoreFoundation 0x0000000112a80e49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
10 CoreFoundation 0x0000000112a4637d __CFRunLoopRun + 2205
11 CoreFoundation 0x0000000112a45884 CFRunLoopRunSpecific + 420
12 GraphicsServices 0x0000000116249a6f GSEventRunModal + 161
13 UIKit 0x0000000112ee0c68 UIApplicationMain + 159
14 dates 0x000000010edac89f main + 111
15 libdyld.dylib 0x000000011516a68d start + 1
16 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
我试过什么?
- 将我的代码与示例应用程序进行比较: Result - 1:1 match 据我所见
- 将 Info.plist 与示例应用程序进行比较:结果 - 1:1 匹配(我复制了相关部分)
- 删除所有框架,清理,重建
- 清理所有模拟器数据(由另一个类似的问题引用)
- 相关问题的尝试方法:(检查未经身份验证的访问)
如果我允许未经身份验证的访问会发生什么?:相同,但响应标头不同:(
2017-02-13 16:25:06.213 dates[25642:544704] AWSiOSSDK v2.5.0 [Debug] AWSURLSessionManager.m line:566 | -[AWSURLSessionManager printHTTPHeadersForResponse:] | Response headers:
{
Connection = "keep-alive";
"Content-Length" = 1612;
"Content-Type" = "application/x-amz-json-1.1";
Date = "Mon, 13 Feb 2017 15:25:05 GMT";
"x-amzn-RequestId" = "98feb58d-f200-11e6-9de9-471b5799b768";
}
2017-02-13 16:25:06.213 dates[25642:544704] AWSiOSSDK v2.5.0 [Debug] AWSURLResponseSerialization.m line:63 | -[AWSJSONResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body:
{"Credentials":{"AccessKeyId":"ASIAISM6BUQFY6FJ4EFQ","Expiration":1.487003106E9,"SecretKey":"rlILMNjU7oeg1NEYgj1y3E1v/5L3IOJNWtZ7jsOf","SessionToken":"AgoGb3JpZ2luEFMaCWV1LXdlc3QtMSKAAgM0QlWyWW3xJ0H3+suiuuekGl6LUznBSikSWbYgLD9C6nPywAyKIlI5EVSN0q7o80q30ZWX8KE/Yjwo+axii1v/A2Qz9gqXWz4HRFwaJnHLE46nNLSJNNkNUhMkYy+azMCdKnZteUEtBzvHcWAVsyqAHtRSzKjGimXfs8WXs7d14g0GabTm73qj7tvOa4Facnetc9aUZjyLLKBsyOAnJKXwAN1xZja91qGbK2Tirfy2qu4kSDtJKcEPaSEnJTBqBlwdXS9D9JTOQNscNZEfpJpFNLdDmJ6ltbS/BwBNv1GscFjdQ2Dx7I76NwX4MO9qOdiqmxmmgK6p7ikO/Jxuq9Yq9AUI2f//////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25642:544675] -[AWSTask exception]: unrecognized selector sent to instance 0x6180002656c0
2017-02-13 16:25:06.222 dates[25642:544675] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[AWSTask exception]: unrecognized selector sent to instance 0x6180002656c0'
*** First throw call stack:
(
0 CoreFoundation 0x000000010ff21d4b __exceptionPreprocess + 171
1 libobjc.A.dylib 0x000000010f98321e objc_exception_throw + 48
2 CoreFoundation 0x000000010ff91f04 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3 CoreFoundation 0x000000010fea7005 ___forwarding___ + 1013
4 CoreFoundation 0x000000010fea6b88 _CF_forwarding_prep_0 + 120
5 dates 0x000000010c43d917 __35-[AWSIdentityManager completeLogin]_block_invoke_2 + 263
6 libdispatch.dylib 0x0000000112559978 _dispatch_call_block_and_release + 12
7 libdispatch.dylib 0x00000001125830cd _dispatch_client_callout + 8
8 libdispatch.dylib 0x00000001125638a4 _dispatch_main_queue_callback_4CF + 406
9 CoreFoundation 0x000000010fee5e49 __CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__ + 9
10 CoreFoundation 0x000000010feab37d __CFRunLoopRun + 2205
11 CoreFoundation 0x000000010feaa884 CFRunLoopRunSpecific + 420
12 GraphicsServices 0x00000001136aea6f GSEventRunModal + 161
13 UIKit 0x0000000110345c68 UIApplicationMain + 159
14 dates 0x000000010c29b89f main + 111
15 libdyld.dylib 0x00000001125cf68d start + 1
16 ??? 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
我越看它似乎是 AWSTask 的一个问题。
有什么想法我下一步可能去哪里吗?