I have this in my viewWillAppear method
[RPCoreData
getFetchedControllerForCategoryDiscoverDelegate:self completion:^(NSFetchedResultsController *controller) {
self.fetchedResultController = controller;
self.fetchedResultController.delegate = self;
}];
and this in my CoreData.m
+ (void)
getFetchedControllerForCategoryDiscoverDelegate:(id<NSFetchedResultsControllerDelegate>)delegate
completion:(void (^)(NSFetchedResultsController *controller))
completion {
[MagicalRecord saveWithBlock:^(NSManagedObjectContext *localContext) {
NSFetchedResultsController *controller = [ItemData MR_fetchAllGroupedBy:@"category.id"
withPredicate:nil
sortedBy:@"category.id"
ascending:NO
delegate:delegate
inContext:localContext];
completion(controller);
}];
}
Aucun commentaire:
Enregistrer un commentaire