我有以下映射:
RKResponseDescriptor *productionParametersPerEquipment = [RKResponseDescriptor responseDescriptorWithMapping:productionParameterMapping
pathPattern:@"/api/rest/productionparameters/?equipment=:equipment_id"
keyPath:@"objects"
statusCodes:RKStatusCodeIndexSetForClass(RKStatusCodeClassSuccessful)];
然后我有:
[objectManager addFetchRequestBlock:^NSFetchRequest *(NSURL *URL) {
RKPathMatcher *pathMatcher = [RKPathMatcher pathMatcherWithPattern:@"/api/rest/productionparameters/?equipment=:equipment_id"];
NSDictionary *argsDict = nil;
BOOL match = [pathMatcher matchesPath:[URL relativePath] tokenizeQueryStrings:NO parsedArguments:&argsDict];
NSString *productionParameterID;
if (match) {
productionParameterID = [argsDict objectForKey:@"id"];
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"ProductionParameter"];
fetchRequest.predicate = [NSPredicate predicateWithFormat:@"identifier = %@", @([productionParameterID integerValue])]; // NOTE: Coerced from string to number
fetchRequest.sortDescriptors = @[ [NSSortDescriptor sortDescriptorWithKey:@"order" ascending:YES] ];
return fetchRequest;
}
return nil;
}];
但是,每当我调用以下命令时,它永远不会匹配,因此我的孤儿永远不会被删除。有任何想法吗?
[[RKObjectManager sharedManager] getObjectsAtPath:[NSString stringWithFormat:@"/api/rest/productionparameters/?equipment=%@",_equipment.identifier] parameters:nil success:^(RKObjectRequestOperation *operation, RKMappingResult *mappingResult)