I have the following JSON I want to load through restkit. I am using Restkit 0.2.3.
JSON Data :
{
"meta": {
"limit": 25,
"cache-expiry": 3600
},
"objects": [
{
"name": "TREATmachine",
"locality": "San Francisco",
"street_address": "20th & Morrison S.E.",
"cuisines": [
"vegan",
"european"
],
"region": "CA",
"phone": "(503) 308-8851",
"postal_code": "94110",
"categories": [
"other",
"restaurant"
],
"has_menu": true,
}
]
}
Now for this I declared this class to handle all elements
@property (nonatomic, retain) NSString* name;
@property (nonatomic, retain) NSString* locality;
@property (nonatomic, retain) NSString* street_address;
@property (nonatomic, retain) NSArray * cuisines;
@property (nonatomic, retain) NSString* region;
@property (nonatomic, retain) NSString* phone;
@property (nonatomic, retain) NSString* postal_code;
@property (nonatomic, retain) NSArray * categories;
@property (assign) BOOL has_menu;
Now the mapping is done like so,
RKObjectMapping *mapping = [RKObjectMapping mappingForClass:[Location class]];
[mapping addAttributeMappingsFromArray:@[@"name",@"locality", @"street_address", @"region",
@"phone", @"postal_code", @"country", @"lat", @"website_url", @"resource_uri"]];
[mapping addAttributeMappingsFromDictionary:@{ @"venueID": @"id"}];
After which I create a
RKResponseDescriptor *responseDescriptor = [RKResponseDescriptor
responseDescriptorWithMapping:mapping method:RKRequestMethodGET pathPattern:@"/Locations
/search/" keyPath:@"objects" statusCodes:statusCodeSet];
and it works fine in getting the data, but the problem I have is that I always get an object that is empty, no data in it.
I do not get a failure or error message, just empty objects.
What am I missing?
Edit : Put in the response descriptor code.