Assertion failure when i use the Add Function

前端 未结 3 686
梦如初夏
梦如初夏 2021-01-03 15:31

In a table, I have 3 indexes which calls each a function. In each function, there is an add button that adds data into CoreData. First 2 works, but when i press the 3rd inde

3条回答
  •  一整个雨季
    2021-01-03 16:19

    I faced the same error. I was using the delegate of NSFetchedResultsControllerDelegate. I comment rest of the delegate except the below one.

    func controllerDidChangeContent(_ controller: NSFetchedResultsController) {  
     self.tableView.reloadData()
     if self.fetchedResultsController.fetchedObjects?.count == 0 {
        } else {
      }
    }
    

    If you want to use all delegate then you need properly manage rows and section. This error occur when you don't manage rows and section properly.

提交回复
热议问题