Add performBlockAndWait: invocation to RKFetchRequestManagedObjectCache

This commit is contained in:
Blake Watters
2013-04-11 17:06:08 -04:00
parent 2bc1442590
commit b7d672fd46

View File

@@ -80,8 +80,11 @@ static NSPredicate *RKPredicateWithSubsitutionVariablesForAttributeValues(NSDict
NSFetchRequest *fetchRequest = [NSFetchRequest fetchRequestWithEntityName:[entity name]];
fetchRequest.predicate = [substitutionPredicate predicateWithSubstitutionVariables:attributeValues];
NSError *error = nil;
NSArray *objects = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
__block NSError *error = nil;
__block NSArray *objects = nil;
[managedObjectContext performBlockAndWait:^{
objects = [managedObjectContext executeFetchRequest:fetchRequest error:&error];
}];
if (! objects) {
RKLogError(@"Failed to execute fetch request due to error: %@", error);
}