How to read next by NSFetchedResultsController

Discussion in 'iOS Programming' started by mikezang, Feb 7, 2013.

  1. mikezang macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #1
    I found all sample in Internet as below
    Code:
    
    - (NSFetchedResultsController *)fetchedResultsController {
        if (self.fetchedResults != nil) {
            return self.fetchedResults;
        }
    
        self.fetchedResults = [NSManagedObject MR_fetchAllGroupedBy:code withPredicate:filter sortedBy:code ascending:YES delegate:self];
        
        self.fetchedResults.delegate = self;
    
        return self.fetchedResults;
    }
    
    My question is if I need to fetch again by different predicate, can I comment code as below?
    Code:
    //    if (self.fetchedResults != nil) {
    //        return self.fetchedResults;
    //    }
    
     
  2. mikezang thread starter macrumors 6502a

    Joined:
    May 22, 2010
    Location:
    Tokyo, Japan
    #2
    Maybe the right way is set fetchedResultsController to nil, then call method and without comment needed.
     

Share This Page