I am having issues deleting my orphaned object the path matcher never matches. What should I use as path if the path contains 2 ids in the path. Thanks.
i.e /api/getEntity/1234/123 where 1234 is the parent id and 123 is the entity id
The request block is below:
NSMutableURLRequest *request = [NSMutableURLRequest
requestWithURL:[NSURL URLWithString:formattedUrl]];
[sharedManager addFetchRequestBlock:^NSFetchRequest *(NSURL *URL) {
RKPathMatcher *pathMatcher = [RKPathMatcher pathMatcherWithPattern::@"/api/getEntity/all/:parentEntityId/:entityId/"]; NSDictionary *argsDict = nil;
BOOL match = [pathMatcher matchesPath:[URL relativePath] tokenizeQueryStrings:NO parsedArguments:&argsDict];
if(match){
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init];
NSEntityDescription *entity = [NSEntityDescription entityForName:@"SomeEntity" inManagedObjectContext:[RKManagedObjectStore
defaultStore].mainQueueManagedObjectContext];
[fetchRequest setEntity:entity]; return fetchRequest;
}
return nil;
}];
This looks like a mismatch in the URL path that you will be loading and the matcher spec of /api/getEntity/all/:parentEntityId/:entityId/
, because you generally don't put a trailing slash on the URL as that denotes a directory and you're actually loading a 'page'. Slashes and therefore structure are important to the matcher.
So, remove the trailing slash.
Generally speaking your base URL should have a trailing slash and all of your path patterns should not have leading or trailing slashes.