【发布时间】:2013-08-06 11:10:18
【问题描述】:
我必须删除服务器不再返回的本地存储数据(孤立对象)。我在初始化对象管理器时使用以下代码。
[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;
}];
在上面的代码中,'match' 条件返回 TRUE。但 Fetch Request 不会删除服务器未返回的孤立对象。
【问题讨论】: