【发布时间】:2015-02-22 14:35:56
【问题描述】:
我开始使用适用于 iOS 的 AWS 移动开发工具包,但无法正确加载项目。我的实体映射得很好,因为我可以将项目保存到 DynamoDB 表中。
我的问题是加载操作后无法获取信息。我正在关注this AWS docs,它说结果将被映射到对象。这是我的代码:
AWSDynamoDBObjectMapper *dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];
DDBUser *user = [DDBUser new];
user.u_id = credentialsProvider.identityId;
[[dynamoDBObjectMapper load:[DDBUser class] hashKey:user.u_id rangeKey:nil] continueWithBlock:^id(BFTask *task) {
if (task.error) {
NSLog(@"The request failed. Error: [%@]", task.error);
return nil;
}
if (task.exception) {
NSLog(@"The request failed. Exception: [%@]", task.exception);
return nil;
}
NSLog(@"name: %@", [(DDBUser *)task.result name]);
NSLog(@"name: %@", [user name]);
return nil;
}];
这里,第一个日志的名称正确,但第二个为空。
非常感谢!
【问题讨论】:
标签: ios mobile amazon-web-services sdk amazon-dynamodb