Ios 客观C法&x27;控制器:didChangeObject:atIndexPath:forChangeType:newIndexPath

Ios 客观C法&x27;控制器:didChangeObject:atIndexPath:forChangeType:newIndexPath,ios,swift,Ios,Swift,Objective-C方法“controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:”由方法提供的“控制器(:didChangeObject:atIndexPath:forChangeType:newIndexPath:)”与协议“NSFetchedResultsControllerDelegate”中的可选要求方法“控制器(:didChangeObject:atIndexPath:forChangeType:newIn

Objective-C方法“controller:didChangeObject:atIndexPath:forChangeType:newIndexPath:”由方法提供的“控制器(:didChangeObject:atIndexPath:forChangeType:newIndexPath:)”与协议“NSFetchedResultsControllerDelegate”中的可选要求方法“控制器(:didChangeObject:atIndexPath:forChangeType:newIndexPath:)”冲突


看起来合适的方法签名是:

func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {

}
任何解决这些问题的简单方法都是允许Xcode自动完成方法签名。然后,用自动生成的签名替换方法的签名。为此,定义方法时只需键入
controller
,即可查看所有匹配方法的列表

func controller(controller: NSFetchedResultsController, didChangeObject anObject: AnyObject, atIndexPath indexPath: NSIndexPath?, forChangeType type: NSFetchedResultsChangeType, newIndexPath: NSIndexPath?) {

}