I am expanding on exploring amazon's DynamoDB with DynamoDBSample
, which they release recently with a bundle of libraries and frameworks called awsiossdk v2
So now the question is, if you go to the dynamoDB console on the web, range key
is optional. So I have created one table with out range key
only with hash
but even though every thing look in place it still look for a rang key
and app crashes.
One thing I suspect is that:
AWSDynamoDBObjectMapper *dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];
I am using defaultDynamoDBObjectMapper
that probably mean hash and range. But I didn’t able to find any other property where the dynamoDBObjectMapper
handle a db write with out a range key.
Appreciate it!
Additional Info.
And here is how I am trying two write to it:
AWSDynamoDBObjectMapper *dynamoDBObjectMapper = [AWSDynamoDBObjectMapper defaultDynamoDBObjectMapper];
[UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{
NSMutableArray *tasks = [NSMutableArray array];
NSString *lat = [info objectForKey:@"lat"];
NSString *lon = [info objectForKey:@"lon"];
NSMutableArray *geoLocationMutable = [[NSMutableArray alloc]init];
[geoLocationMutable addObject:lat];
[geoLocationMutable addObject:lon];
NSNCurrentStatusTable *currentStatusTableRow = [NSNCurrentStatusTable new];
currentStatusTableRow.uuid = [[UIDevice currentDevice].identifierForVendor UUIDString];
currentStatusTableRow.lastOnlineTime = [[info objectForKey:@"fullTimeNow"] substringFromIndex:2];
currentStatusTableRow.geoLocation = geoLocationMutable;
currentStatusTableRow.latitude = [info objectForKey:@"latNum"];
currentStatusTableRow.longitude = [info objectForKey:@"lonNum"];
[tasks addObject:[dynamoDBObjectMapper save:currentStatusTableRow]];
[[BFTask taskForCompletionOfAllTasks:tasks]
continueWithExecutor:[BFExecutor mainThreadExecutor] withBlock:^id(BFTask *task) {
if (task.error) {
NSLog(@"Error: [%@]", task.error);
[self getNextStep:YES];
}
else
{
[self getNextStep:YES];
}
return nil;
}];
[UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
});
});