i just started out working on a project using Amazon Web Services SimpleDB.
in one method i am trying to figure out how many items a domain already contains by using a select query
.
The code looks like this:
AmazonSimpleDBClient *dbClienet = [[AmazonSimpleDBClient alloc]initWithAccessKey:_secret withSecretKey:_hiddenSecret];
NSString *countRequestString = [NSString stringWithFormat:@"select count(*) from %@",domain];
SimpleDBSelectRequest *countRequest = [[SimpleDBSelectRequest alloc]initWithSelectExpression:countRequestString];
SimpleDBSelectResponse *countResponse = [dbClienet select:countRequest];
This works just fine. eg: the connection works, and the response seems to be right as well when i log it:
{Items: (
"{Name: Domain,AlternateNameEncoding: (null),Attributes: (\n \
"{Name: Count,AlternateNameEncoding: (null),Value: 2,AlternateValueEncoding: (null),<SimpleDBAttribute: 0x756f730>}\"\n),<SimpleDBItem: 0x7529d00>}"),NextToken: (null),{BoxUsage: 0.000023,{requestId: b683ed01-9e5f-9041-1ace-cbb0fdfaa799}}}
What i want to do next, is to save the value2
into an NSInteger itemCount
. Here is where i struggle.
I tried several things, the furthest i came was:
NSInteger itemCount = [[[[[countResponse.items objectAtIndex:0]attributes]objectAtIndex:1]value]integerValue];
which should work in my eyes. but it throws the error:
Multiple methods named 'value' found with mismatched result, parameter type or attributes
Can anyone point out to me where i went wrong? I am truly stuck here.
Thanks, Sebastian