I have a RestKit based application with one class mapped. Everything seems to be working fine. However, when I retrieve the objects, RestKit throws a warning:
W restkit.object_mapping:RKObjectMapper.m:90 Found a collection containing only NSNull values, considering the collection unmappable...
The warning appears twice (presumably because there are two objects in the JSON response). How can i fix this?
Here is my mapping:
RKManagedObjectMapping* presentationMapping = [RKManagedObjectMapping mappingForClass:[Presentation class]]; presentationMapping.primaryKeyAttribute = @"presentationId"; [presentationMapping mapKeyPath:@"id" toAttribute:@"presentationId"]; [presentationMapping mapKeyPath:@"title" toAttribute:@"title"]; [presentationMapping mapKeyPath:@"description" toAttribute:@"descriptionText"]; [presentationMapping mapKeyPath:@"download_url" toAttribute:@"downloadUrlString"]; [presentationMapping mapKeyPath:@"download_file_size" toAttribute:@"downloadFileSize"]; [objectManager.mappingProvider setMapping:presentationMapping forKeyPath:@"presentation"];
This is how I retrieve the objects:
[[RKObjectManager sharedManager] loadObjectsAtResourcePath:@"/presentations" delegate:self];
Here is my JSON structure (obtained via curl):
[ { "presentation": { "created_at":"2011-08-13T17:09:40+02:00", "description":"Lorem ipsum", "id":1, "title":"Xxx", "updated_at":"2011-08-13T17:09:40+02:00", "download_url":"http://xxx.example.com/system/downloads/1/original/presentation1.zip?1313248180", "download_file_size":171703 } }, { "presentation": { "created_at":"2011-08-13T17:10:30+02:00", "description":"Dolor sit amet", "id":2, "title":"Zzz", "updated_at":"2011-08-15T00:22:10+02:00", "download_url":"http://xxx.example.com/system/downloads/2/original/zzz.zip?1313360530", "download_file_size":3182117 } } ]
The server is a Rails 3.0 application that I control and can change the response format if necessary.
I am using RestKit 0.9.3.