RestKit warning: "Found collection containing only NSNull values ​​..."

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.

+6
source share
2 answers

This warning is not a sign of incorrect display. In fact, this message should probably be logged as Debug or Trace, as this can happen as part of a normal object mapping. I will send a transfer request to change the log level in the future. Therefore, be sure that your mapping is perfect and no changes are required to calm this warning. :)

+1
source

Still receiving this warning from the newly installed RestKit, I made the following change to the RestKit code.

 FILE: RKPbjectMapper.m FUNCTION: (BOOL)isNullCollection:(id)object LINE: 104 

changes:

 RKLogWarning(@"Found a collection containing only NSNull values, considering the collection unmappable..."); 

in

 RKLogDebug(@"Found a collection containing only NSNull values, considering the collection unmappable..."); 
0
source

Source: https://habr.com/ru/post/895054/


All Articles