I have to delete local store data (orphaned objects) which is no longer returned by server. I am using the following code when initilializing object manager.
[objectManager addFetchRequestBlock:^NSFetchRequest *(NSURL *URL) {
RKPathMatcher *pathMatcher = [RKPathMatcher pathMatcherWithPattern:@"/relative_path"];
NSDictionary *argsDict = nil;
BOOL match = [pathMatcher matchesPath:[URL relativePath] tokenizeQueryStrings:NO parsedArguments:&argsDict];
if (match) {
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:@"Articles"];
return fetchRequest;
}
return nil;
}];
In the above code, 'match' condition returns TRUE. But Fetch Request doesn't delete the orphaned objects which was not returned by the server.