我正在尝试从https://github.com/awslabs/aws-sdk-ios-samples/tree/master/CognitoSync-Sample/Swift运行这个AWS cognito示例应用程序。我可以添加新的数据集,但一旦尝试同步/刷新,就会出现以下错误。我不想和任何提供者打交道。只是简单的数据同步。
下面是我的步骤-
1.从github下载了示例应用程序。
2.使用给定的吊舱安装AWSCognito
3.并在Amazon Cognoto控制台中创建了一个标识池
4.并更新常数中的常数。swift-
静态let COGNITO_REGIONTYPE=AWSRegionType.USEast1
静态let COGNITO_IDENTITY_POOL_ID=“us-east-1_uuxxxxx”
这是我控制台的错误-

2016-05-11 15:43:49.643 CognitoSyncDemo[18352:6625488] AWSiOSSDKv2 [Debug] AWSCognitoSQLiteManager.m line:179 | __51-[AWSCognitoSQLiteManager initializeDatasetTables:]_block_invoke | sqlString = 'INSERT INTO CognitoMetadata(Dataset,ModifiedBy,IdentityId) VALUES (?,?,?)'
2016-05-11 15:43:49.643 CognitoSyncDemo[18352:6625488] AWSiOSSDKv2 [Debug] AWSCognitoSQLiteManager.m line:282 | __53-[AWSCognitoSQLiteManager loadDatasetMetadata:error:]_block_invoke | query = 'SELECT LastSyncCount, LastModified, ModifiedBy, CreationDate, DataStorage, RecordCount FROM CognitoMetadata WHERE IdentityId = ? and Dataset = ?'
2016-05-11 15:43:49.647 CognitoSyncDemo[18352:6625968] AWSiOSSDKv2 [Verbose] AWSURLRequestSerialization.m line:103 | -[AWSJSONRequestSerializer serializeRequest:headers:parameters:] | Request body: [{"IdentityPoolId":"us-east-1_1kBTIfzWu"}]
2016-05-11 15:43:50.942 CognitoSyncDemo[18352:6626097] AWSiOSSDKv2 [Debug] AWSURLResponseSerialization.m line:74 | -[AWSJSONResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response header: [{
Connection = close;
"Content-Length" = 218;
"Content-Type" = "application/x-amz-json-1.1";
Date = "Wed, 11 May 2016 10:13:50 GMT";
"x-amzn-ErrorMessage" = "1 validation error detected: Value 'us-east-1_1kBTIfzWu' at 'identityPoolId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+:[0-9a-f-]+";
"x-amzn-ErrorType" = "ValidationException:";
"x-amzn-RequestId" = "0ec70838-1761-11e6-91c2-e77b976ab658";
}]
2016-05-11 15:43:50.942 CognitoSyncDemo[18352:6626097] AWSiOSSDKv2 [Verbose] AWSURLResponseSerialization.m line:79 | -[AWSJSONResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body: [{"__type":"ValidationException","message":"1 validation error detected: Value 'us-east-1_1kBTIfzWu' at 'identityPoolId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+:[0-9a-f-]+"}]
2016-05-11 15:43:50.943 CognitoSyncDemo[18352:6626097] AWSiOSSDKv2 [Error] AWSIdentityProvider.m line:185 | __51-[AWSAbstractCognitoIdentityProvider getIdentityId]_block_invoke169 | GetId failed. Error is [Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=0 "(null)" UserInfo={__type=ValidationException, message=1 validation error detected: Value 'us-east-1_1kBTIfzWu' at 'identityPoolId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+:[0-9a-f-]+}]
2016-05-11 15:43:50.943 CognitoSyncDemo[18352:6625968] AWSiOSSDKv2 [Verbose] AWSURLRequestSerialization.m line:103 | -[AWSJSONRequestSerializer serializeRequest:headers:parameters:] | Request body: [{"IdentityPoolId":"us-east-1_1kBTIfzWu"}]
2016-05-11 15:43:52.168 CognitoSyncDemo[18352:6626097] AWSiOSSDKv2 [Debug] AWSURLResponseSerialization.m line:74 | -[AWSJSONResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response header: [{
Connection = close;
"Content-Length" = 218;
"Content-Type" = "application/x-amz-json-1.1";
Date = "Wed, 11 May 2016 10:13:51 GMT";
"x-amzn-ErrorMessage" = "1 validation error detected: Value 'us-east-1_1kBTIfzWu' at 'identityPoolId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+:[0-9a-f-]+";
"x-amzn-ErrorType" = "ValidationException:";
"x-amzn-RequestId" = "0f7792fc-1761-11e6-9ad4-59d8bf47e69e";
}]
2016-05-11 15:43:52.168 CognitoSyncDemo[18352:6626097] AWSiOSSDKv2 [Verbose] AWSURLResponseSerialization.m line:79 | -[AWSJSONResponseSerializer responseObjectForResponse:originalRequest:currentRequest:data:error:] | Response body: [{"__type":"ValidationException","message":"1 validation error detected: Value 'us-east-1_1kBTIfzWu' at 'identityPoolId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+:[0-9a-f-]+"}]
2016-05-11 15:43:52.168 CognitoSyncDemo[18352:6626097] AWSiOSSDKv2 [Error] AWSIdentityProvider.m line:185 | __51-[AWSAbstractCognitoIdentityProvider getIdentityId]_block_invoke169 | GetId failed. Error is [Error Domain=com.amazonaws.AWSCognitoIdentityErrorDomain Code=0 "(null)" UserInfo={__type=ValidationException, message=1 validation error detected: Value 'us-east-1_1kBTIfzWu' at 'identityPoolId' failed to satisfy constraint: Member must satisfy regular expression pattern: [\w-]+:[0-9a-f-]+}]
2016-05-11 15:43:52.169 CognitoSyncDemo[18352:6626097] AWSiOSSDKv2 [Error] AWSCognitoService.m line:176 | __36-[AWSCognito refreshDatasetMetadata]_block_invoke147 | Unable to list datasets: Error Domain=com.amazon.cognito.AWSCognitoErrorDomain Code=-4000 "(null)"

我错过了什么?我对AWS服务很陌生,任何指导都会非常感谢。
谢谢,
里沙

最佳答案

我使用的是用户池id而不是标识池id。现在已解决此问题。

关于ios - AWS Cognito示例应用程序存在问题,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/37160945/

10-09 07:03