我为自己的API请求创建了一些包装类,如下所示:
+ (void)sendGETRequestWithURLString:(NSString *)request mapping:(NSString *)mapping withFailBlock:(RKRequestDidFailLoadWithErrorBlock)failBlock completion:(kServiceCompleteBlock)completion {
RKObjectManager *manager = [RKObjectManager sharedManager];
[manager loadObjectsAtResourcePath:request usingBlock:^(RKObjectLoader *loader) {
loader.onDidLoadResponse = ^(RKResponse *response) {
[self fireErrorBlock:failBlock onErrorInResponse:response];
if (completion)
completion(response);
};
}];
}
我正在尝试映射回复。当我使用RestKit 0.9时,我将其映射到AppDelegate中,如下所示:
RKObjectMapping* categoryMapping = [RKObjectMapping mappingForClass:[Category class]];
[categoryMapping mapKeyPath:@"id" toAttribute:@"categoryID"];
[categoryMapping mapKeyPath:@"name_ar" toAttribute:@"arabicName"];
[categoryMapping mapKeyPath:@"name_en" toAttribute:@"englishName"];
[categoryMapping mapKeyPath:@"img" toAttribute:@"imageUri"];
[categoryMapping mapKeyPath:@"img_en" toAttribute:@"imageEnUri"];
如何将上述映射连接到上面10.0代码中的前一个代码?