Objective-C
- 1 ответ
- 0 вопросов
1
Вклад в тег
RKObjectMapping *profilesMapping = [RKObjectMapping mappingForClass:[LVKUser class]];
[profilesMapping addAttributeMappingsFromArray:@[@"uid",
@"first_name",
@"last_name",
@"nickname"]];
RKResponseDescriptor *responseDescriptor =
[RKResponseDescriptor responseDescriptorWithMapping:profilesMapping
method:RKRequestMethodGET
pathPattern:@"users.get"
keyPath:@"response"
statusCodes:[NSIndexSet indexSetWithIndex:200]];
[objectManager addResponseDescriptor:responseDescriptor];
NSDictionary *params = @{@"fields": @"nickname", @"user_id": @"1"};
[[RKObjectManager sharedManager] getObjectsAtPath:@"users.get"
parameters:params
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult){
NSLog(@"%@", mappingResult.array);
}
failure:^(RKObjectRequestOperation *operation, NSError *error){
NSLog(@"%@", error);
NSLog(@":c");
}
];