1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Enumeration values 'NSFetchedResultsChangeMove' and 'NSFetchedResultsChangeUpdate' not handled in switch

1
Posted at

Enumeration values 'NSFetchedResultsChangeMove' and 'NSFetchedResultsChangeUpdate' not handled in switch

という警告が出た時。

- (void)controller:(NSFetchedResultsController *)controller didChangeSection:(id <NSFetchedResultsSectionInfo>)sectionInfo
           atIndex:(NSUInteger)sectionIndex forChangeType:(NSFetchedResultsChangeType)type
{
    switch(type) {
        case NSFetchedResultsChangeInsert:
            [self.tableView insertSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
            break;
            
        case NSFetchedResultsChangeDelete:
            [self.tableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
            break;
    }
}

上記のメソッドは、InsertとDeleteについては書いてあるのですが、MoveとUpdateについてはなにも書かれていないために警告が出ています。
なので、なんでもいいので追記します。

case NSFetchedResultsChangeMove:
	NSLog(@"A table item was moved");
	reak;
case NSFetchedResultsChangeUpdate:
	NSLog(@"A table item was updated");
	break;

これでOK。

参照元
http://stackoverflow.com/questions/25752758/enumeration-values-nsfetchedresultschangemove-and-nsfetchedresultschangeupdate

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?