Swift 2.0转换问题NSFetchedResultsController didChangeObject

Vla*_*iak 3 core-data nsfetchedresultscontroller swift

在Swift 2.0中转换后我无法解决问题:

"Objective-C方法"控制器:didChangeObject:atIndexPath:forChangeType:newIndexPath:'由方法'controller(:didChangeObject:atIndexPath:forChangeType:newIndexPath :)提供'与可选需求方法'controller(:didChangeObject:atIndexPath:forChangeType:newIndexPath)冲突:)'在协议'NSFetchedResultsControllerDelegate'"

请帮我.谢谢你的进步

func controllerWillChangeContent(controller: NSFetchedResultsController) {
    tableView.beginUpdates()
}

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

    // the issue is here

    switch type {

    case NSFetchedResultsChangeType.Insert:
        if let newIndex = newIndexPath {
            tableView.insertRowsAtIndexPaths([newIndex], withRowAnimation: UITableViewRowAnimation.Automatic)
        }

    case NSFetchedResultsChangeType.Delete:
        if let index = indexPath {
            tableView.deleteRowsAtIndexPaths([index], withRowAnimation: UITableViewRowAnimation.Automatic)
        }
    }
}

func controllerDidChangeContent(controller: NSFetchedResultsController) {
    tableView.endUpdates()
}
Run Code Online (Sandbox Code Playgroud)

Ber*_*ana 5

更改呼叫didChangeObject anObject: NSManagedObjectdidChangeObject anObject: AnyObject.新方法如下所示:

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

}
Run Code Online (Sandbox Code Playgroud)

NSFetchedResultsController委托方法