添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接

Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here .

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

I think there's something missing, I get an error if I try to delete an item (Invalid update: invalid number of rows)

CoreData: error: Serious application error. An exception was caught from the delegate of NSFetchedResultsController during a call to -controllerDidChangeContent:. Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (1) must be equal to the number of rows contained in that section before the update (2), plus or minus the number of rows inserted or deleted from that section (0 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out). with userInfo (null)

Solved it! - I ran into the same problem and realised what I had done wrong...

case.Delete:
      guard let indexPath = indexPath else { return }
      tableView.deleteRowsAtIndexPaths([indexPath], withRowAnimation: .Automatic)

Check your code matches above, I made the mistake of trying to use newIndexPath (instead of indexPath) and putting the incorrect method call to the tableView (3 different methods for insert, delete and reload).

Hope that helps,