title: custom sections based on current date for nsfectedresultscontroller
body: <p>I want to use three sections for a tableview:</p>
  
  <p>New Issues = issues reported on this date regardless of status.
  Active Issues = issues reported prior to this date still requiring follow up.
  Closed Issues = issues reported prior to this date, not requiring follow up.</p>
  
  <p>I have a transient property which correctly reports the sections - 0,1,2 respectively.</p>
  
  <p>I have tried numerous ways to get my NSFetchedResultsController to sort the results correctly for the tableview to display. I find you cannot sort on the transient property in the NSFetchedResultsController so I tried to sort like so:</p>
  
  <pre><code>     //create sort keys
  NSDateFormatter *df = [[NSDateFormatter alloc] init];
  [df setDateStyle:NSDateFormatterShortStyle];
  [df setTimeStyle:NSDateFormatterNoStyle];
  NSString *nowString = [df stringFromDate:[NSDate date]];
  NSDate *todayDateWithoutTime = [df dateFromString:nowString];
  [df release];
  NSSortDescriptor *sortIsNew = [[NSSortDescriptor alloc] initWithKey:@"dateReported" ascending:YES comparator:^(id obj1,id obj2){
      NSDate *date1 = obj1;
      NSDate *date2 = obj2;
      NSComparisonResult comparisonResult;
      if ([date1 timeIntervalSinceDate:todayDateWithoutTime] == 0) {
          if ([date2 timeIntervalSinceDate:todayDateWithoutTime] == 0) {
              comparisonResult = NSOrderedSame;
          } else {
              comparisonResult = NSOrderedAscending;
          }
      } else {
          if ([date2 timeIntervalSinceDate:todayDateWithoutTime] == 0) {
              comparisonResult =  NSOrderedDescending;
          } else {
              comparisonResult = NSOrderedSame;
          }
      }
      return comparisonResult;
  }];
  NSSortDescriptor *sortByFollowUp = [[NSSortDescriptor alloc] initWithKey:@"requiresFollowUp" ascending:NO];
  NSSortDescriptor *sortByReportDate = [[NSSortDescriptor alloc] initWithKey:@"dateReported" ascending:NO];
  NSArray *sortDescriptors = [[NSArray alloc] initWithObjects:sortIsNew, sortByFollowUp,sortByReportDate, nil];
  [fetchRequest setSortDescriptors:sortDescriptors];
  </code></pre>
  
  <p>Not so sure my usage of the block is correct, but in any case it never gets called so far as I can tell. I put some log statements in there and they do not report. Apparently the "sortByFollowUp" and "sortByReportDate" descriptors work as expected, but not the "sortIsNew". If there are no new  Issues everything works fine. In any case where there are new Issues for that first section, the app crashes as the sorting does not match the sections.</p>
  
  <p>I know I can do this very easily with straight up fetch requests and arrays. It only seems right to use the fetched results controller to avoid pulling the entire table of Issues into memory when most are unneeded and only a few will be displayed at any given moment. Can it really be this difficult to use it when you want custom sections?</p>