This seems to work, but it's not setting up the spatial reference correctly:
NSDictionary *sRJSON=[NSDictionary dictionaryWithObjectsAndKeys:@"4326", @"wkid", nil];
NSDictionary *locationJSON=[NSDictionary dictionaryWithObjectsAndKeys:@"-122.408951", @"x", @"37.783206", @"y", nil];
NSDictionary *attributesJSON=[NSDictionary dictionaryWithObjectsAndKeys:@"MASON", @"StreetName", @"ST", @"StreetType", nil];
NSDictionary *json=[NSDictionary dictionaryWithObjectsAndKeys:sRJSON, @"spatialReference", @"1 MASON ST", @"address", locationJSON, @"location", @"75", @"score", attributesJSON, @"attributes", nil];
AGSAddressCandidate *candidate=[[AGSAddressCandidate alloc ]initWithJSON:json];
NSLog(@"***Address Candidate Start***");
//Display the address cey 03.18.10
NSLog(@"Address Candidate String: %@",[candidate addressString]);
//Display the location cey 03.18.10
//What's the spatial reference of the locator? How can I find that out at the endpoint? Wouldn't it make sense to be able to retrieve the spatial reference from the point?
AGSPoint *location = [candidate location];
NSLog(@"Address Candidate @ (%f,%f,%@)",[location x], [location y], [location spatialReference]);
NSDictionary *address = [candidate address];
NSLog(@"Address Candidate Fields Count: %d", [address count]);
for(NSString *aKey in address)
{
NSLog(@"Key: %@ Value: %@", aKey, [address objectForKey:aKey]);
}
NSDictionary *attributes = [candidate attributes];
NSLog(@"Address Candidate Attributes Count: %d", [attributes count]);
for(NSString *aKey in attributes)
{
NSLog(@"Key: %@ Value: %@", aKey, [attributes objectForKey:aKey]);
}
NSLog(@"Address Candidate Score: %f",[candidate score]);
NSLog(@"***Address Candidate End***");
Output:
2010-06-14 17:20:07.679 AGSAddressCandidate[973:207] ***Address Candidate Start***
2010-06-14 17:20:07.682 AGSAddressCandidate[973:207] Address Candidate String: 1 MASON ST
2010-06-14 17:20:07.683 AGSAddressCandidate[973:207] Address Candidate @ (-122.408951,37.783206,(null))
2010-06-14 17:20:07.683 AGSAddressCandidate[973:207] Address Candidate Fields Count: 0
2010-06-14 17:20:07.684 AGSAddressCandidate[973:207] Address Candidate Attributes Count: 2
2010-06-14 17:20:07.684 AGSAddressCandidate[973:207] Key: StreetType Value: ST
2010-06-14 17:20:07.685 AGSAddressCandidate[973:207] Key: StreetName Value: MASON
2010-06-14 17:20:07.685 AGSAddressCandidate[973:207] Address Candidate Score: 75.000000
2010-06-14 17:20:07.686 AGSAddressCandidate[973:207] ***Address Candidate End***