I have a viewController with a UITableView
, the rows of which I allow to edit (delete) with a swipe - much like in the Mail app. I do it with, among other, this met
Use
tableview.delegate = nil in dealloc()
Use
tableView=nil
I had the same problem, but I was using ARC and I didn't want to be mucking about in the dealloc method. Doing it in viewWillDisappear was sufficient to stop the crash.
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
[table setEditing:NO];
}
In your view controller's dealloc
method, set the table view's editing
property to NO
.
I know this is an old post, but I recently had this problem, and thought others might benefit from what I found: I am using Xcode 9 and iOS 11, and I am employing the new method of using a SearchController. If I clicked the system back button while I was searching, I got the fatal on tableView(_: canEditRowAt indexPath:). Changing setEditing to false did not solve my issue. The problem was that I returned true/false in my canEditRowAt override depending upon if my data source had records, but when I was searching, I had a different data source (a filtering array). Once I checked against the right data source, the back button worked.