UITableView didSelectRowAt is not called iOS 10, but works for 9.3.5

There are lots of questions regarding this problem, but the answers I have found so far are not applicable. In this case, the table works correctly in iOS 9.3.5, but not for iOS 10 (or 10.3.1)

I have ruled out:

  • Setting Slider Value to Set SeekToTime in AVPlayer
  • iBeacon : What is the difference between didEnterRegion and didDetermineState(CLRegionStateInside)
  • Swift 3 : Error: Type 'Any' has no subscript member
  • Mac Dock like magnification for iPad
  • Creating an image out of the ios surface and saving it
  • Cropping CIImage
    • Not setting up the delegate properly. The delegate performs 3 functions, didSelectRowAt, heightForRowAt, and editActionsForRowAt. The latter is the right-to-left swipe which gives the option to perform the exact same functionality as selecting the row.. These three functions work correctly on v9.3.5 (as tested via simulator and and older iPad I test with.) When I use v10 via the simulator or my iPhone SE, the heightForRowAt, and editActionsForRowAt work but not the didSelectRowAt (and for that matter – I tried willSelectRowAt. It also did not work for v10.)
    • Any typographical error (because it works for 9.3.5)

    I have not been able to find anything about a Swift change regarding tableView(:didSelectRowAt) from iOS 9 to iOS 10.

    Background

    I have a view controller with a corresponding xib (“DetailVC”). This xib has a label then a tableview underneath the label. The table’s cell is another xib.

    The view controller presented via

    let uomVC = DetailVC()
    self.navigationController?.pushViewController(uomVC, animated: true)
    

    Then within DetailVC, I use a NSFetchedDataController and connect it to tableview via the tableView Data Source delegate. (Core data loads and displays great.)

    Code (I’ll post additional code as needed/ requested – Swift 3)

    viewDidLoad() – partial

    let nib: String = "DetailCell"
    let reuseID: String = "detailCell"
    tableView.register(UINib.init(nibName: nib, bundle: nil), forCellReuseIdentifier: reuseID)
    

    tableView(:cellForRowAt)

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: reuseID) as! IngredientDetailCell
        cell.present(ingredient: _fetchedResultsController.object(at: indexPath))
        cell.isUserInteractionEnabled = true // Added later as a guess per SO suggestions
        return cell
    }
    

    For arguments sake – this won’t print

    func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {      
        print("Selected a row")
        // delegate?.selectedIngredient(_fetchedResultsController.object(at: indexPath))
        // self.navigationController?.popViewController(animated: true)
    }
    

    View

    tableViewCell

    Solutions Collect From Internet About “UITableView didSelectRowAt is not called iOS 10, but works for 9.3.5”

    For completeness in case anyone has this strange situation.

    The problem was my UITableViewCell xib. I must have originally designed it as a UIView, then added the UITableViewCell. The hierarchy should begin with the UITableViewCell. I moved the UITableViewCell out from underneath the view (circled in red), deleted the view and re-connected the IBOutlets. It’s just strange that it worked with iOS 9.3.5.

    enter image description here