Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
__NSmallocblock\亚马逊AWS发电机错误-iOS_Ios_Amazon Web Services_Amazon Dynamodb - Fatal编程技术网

__NSmallocblock\亚马逊AWS发电机错误-iOS

__NSmallocblock\亚马逊AWS发电机错误-iOS,ios,amazon-web-services,amazon-dynamodb,Ios,Amazon Web Services,Amazon Dynamodb,我在Dynamo AWS中遇到了一个问题,我试图从数据库中获取ID,并随机获得内存分配错误。 以下是我用来获取信息的代码: AWSCognitoCredentialsProvider *credentialsProvider = [AWSCognitoCredentialsProvider credentialsWithRegionType:AWSRegionUSEast1

我在Dynamo AWS中遇到了一个问题,我试图从数据库中获取ID,并随机获得内存分配错误。 以下是我用来获取信息的代码:

AWSCognitoCredentialsProvider *credentialsProvider = [AWSCognitoCredentialsProvider credentialsWithRegionType:AWSRegionUSEast1
                                                                                                    accountId:AWSAccountID
                                                                                               identityPoolId:CognitoPoolID
                                                                                                unauthRoleArn:CognitoRoleUnauth
                                                                                                  authRoleArn:CognitoRoleAuth];

//Set the server connection to AWSRegionUSEast1 with the credentials
AWSServiceConfiguration *configuration = [AWSServiceConfiguration configurationWithRegion:AWSRegionUSEast1
                                                                      credentialsProvider:credentialsProvider];
[AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
[AWSLogger defaultLogger].logLevel = AWSLogLevelVerbose;

NSString *token = FBSession.activeSession.accessTokenData.accessToken;
credentialsProvider.logins = @{ @(AWSCognitoLoginProviderKeyFacebook): token };

//Access the users table with the Facebook ID.
DDBTableRow *tableRow = [DDBTableRow new];
tableRow.UsersHash1ID = [defaults objectForKey:@"UserID"];
tableRow.UsersRange1 = [defaults objectForKey:@"UserID"];

AWSDynamoDBObjectMapper *dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];

//Create a load connection to the AWS Dynamo database to find out if the user already exists
[[dynamoDBObjectMapper load:[DDBTableRow class]
                    hashKey:tableRow.UsersHash1ID
                   rangeKey:tableRow.UsersRange1] continueWithExecutor:[BFExecutor mainThreadExecutor] withBlock:^id(BFTask *task) {
    if (!task.error) {
        DDBTableRow *tableRow = task.result;
        //TODO: Crashes
        if (tableRow.UsersHash1ID == nil) {// if the user does not exist.
            [self firstPlay];
        } else {
            [self SecondPlay]; //If the user exist already in the database.
        }
    } else { //Error handling
        NSLog(@"Error: [%@]", task.error);
        //TODO: handle the connection

        HUD.textLabel.text = @"Error Connecting to Database";

        [HUD dismissAfterDelay:5.0];

    }
    return nil;
}];
这就是我收到的错误:


有人知道如何解决这个问题吗?

-load:hashKey:rangeKey:
是一种异步方法。这意味着您创建的第一个
tableRow
对象可以在
-load:hashKey:rangeKey:
完成执行之前解除分配

你可以重写这一部分

[dynamoDBObjectMapper load:[DDBTableRow class]
                   hashKey:tableRow.UsersHash1ID
                  rangeKey:tableRow.UsersRange1]
差不多

[dynamoDBObjectMapper load:[DDBTableRow class]
                   hashKey:[defaults objectForKey:@"UserID"]
                  rangeKey:[defaults objectForKey:@"UserID"]]
(您正在为哈希键和范围键设置相同的值。您应该确保这是您真正想要的。)

如果它不能解决问题,您应该启用NSZombie并查看释放的对象