0
我用RestKit版本0.26和嘗試映射到核心數據的響應RestKit - 響應描述不添加
這是我用我使用的代碼的代碼構建的要求和描述符:
-(void)getProductListProductWithPageNumber: (int) pageNumber managedObjectStore: (RKManagedObjectStore *)managedObjectStore {
// initialize AFNetworking HTTPClient
NSURL *baseURL = [NSURL URLWithString:@"https://server.com"];
AFHTTPClient *client = [[AFHTTPClient alloc] initWithBaseURL:baseURL];
RKObjectManager *objectManager = [[RKObjectManager alloc] initWithHTTPClient:client];
objectManager.managedObjectStore = managedObjectStore;
RKResponseDescriptor *productListrResponseDescriptor =
[RKResponseDescriptor responseDescriptorWithMapping:[[CategoricalSystemDownloadManager sharedDownloadManager] getCDProductListProductMapping:managedObjectStore]
method:RKRequestMethodGET
pathPattern:@"/PLController/plProducts/:"
keyPath:nil
statusCodes:[NSIndexSet indexSetWithIndex:200]];
[objectManager addResponseDescriptor:productListrResponseDescriptor];
[objectManager getObjectsAtPath:[NSString stringWithFormat:@"/PLController/plProducts/currentResponseBody-%d", pageNumber]
parameters:nil
success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult) {
}
failure:^(RKObjectRequestOperation *operation, NSError *error) {
}];
}
映射的JSON確實是一個數組 - >鍵路徑爲零,對不對? 它看起來像這樣: [ { 「的productId」:240, 「brandId」:69 } ]
這是
which failed to match all (0) response descriptors