我有一个房间实体,以及许多消息实体关联。
我使用这个FRC来获取一个房间里的所有消息:
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(rid == %@) AND (status >= 0)", _room];
_fetchControllerForHistory = [Message MR_fetchAllSortedBy:@"serverDatetime,index" ascending:YES withPredicate:predicate groupBy:nil delegate:self];
过去几个月它运行良好,但在我更新应用程序以使用新版本的MagicalRecord后,问题出现了。
我猜我从服务器代码获取的新数据有问题, 它现在看起来像这样:
dispatch_async(retrieve_queue(), ^{
ASIHTTPRequest *roomRequest = //code to genrate the request;
[roomRequest startSynchronous];
if (!roomRequest.error)
{
[MagicalRecord saveWithBlock:^(NSManagedObjectContext *localContext) {
// code to parse the data
}];
}
});
取完后,每个房间都至少会有消息。 但即使在该房间中有一条消息且状态为> FRC也不会返回任何结果。 0
NSLog(@"%i,%i",_room.mids.count, self.fetchControllerForHistory.fetchedObjects.count);
1,0
感谢。