Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to tackle "user": null #5

Open
HHuckebein opened this issue May 27, 2013 · 0 comments
Open

How to tackle "user": null #5

HHuckebein opened this issue May 27, 2013 · 0 comments

Comments

@HHuckebein
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant