Skip to content

How to tackle "user": null #5

@HHuckebein

Description

@HHuckebein

Tried to enhance the sample project starting with the user information by doing

    // User Entity
    RKEntityMapping *userEntityMapping = [RKEntityMapping mappingForEntityForName:@"User" inManagedObjectStore:managedObjectStore];
    userEntityMapping.identificationAttributes = @[@"userID"];
    [userEntityMapping addAttributeMappingsFromDictionary:@{
        @"id"          : @"userID",
        @"avatar_url"  : @"avatarURL",
        @"gravatar_id" : @"gravatarID",
        @"url"         : @"jsonURL",
        @"login"       : @"login"}];

    RKResponseDescriptor *userResponseDescriptor = [RKResponseDescriptor responseDescriptorWithMapping:userEntityMapping pathPattern:@"/gists/public" keyPath:@"user" statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];

    [objectManager addResponseDescriptor:userResponseDescriptor];

but as the json contains some users with null values I got an exception in

static NSDictionary *RKEntityIdentificationAttributesForEntityMappingWithRepresentation(RKEntityMapping *entityMapping, NSDictionary *representation)

I can see that in

- (NSArray *)mapRepresentations:(id)representations atKeyPath:(NSString *)keyPath usingMapping:(RKMapping *)mapping

the objectsToMap array some [NSNull null] value are inserted.
Couldn't find any protocol/delegate calls to avoid having null values added to this array.

Any help is appreciated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions