【问题标题】:Handle NSFetchedResultsController DidChangeSection IOS Core Data处理 NSFetchedResultsController DidChangeSection IOS 核心数据
【发布时间】:2016-08-01 04:47:05
【问题描述】:

我正在编写一个实现来处理 NSFetchResultsController DidChangeSection 但我收到了这个奇怪的警告

这是我的方法

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

        case NSFetchedResultsChangeDelete:
            [stampsTableView deleteSections:[NSIndexSet indexSetWithIndex:sectionIndex] withRowAnimation:UITableViewRowAnimationFade];
            break;
    }
}

警告如下图。我该如何解决这个警告?

【问题讨论】:

    标签: ios core-data nsfetchrequest


    【解决方案1】:

    添加默认以处理其他情况

    switch (type) {
        case NSFetchedResultsChangeInsert:
            break;
        case NSFetchedResultsChangeDelete:
            break;
        default:
            break;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-01
      • 2011-01-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多