-3

I have the following method that would call the "updateMapView(sender:UIButton)" method but I get the unrecognized selector error. I have set the action: attribute with other variations such as updateMapView:sender and stuff so it's not a problem there. What might be it though?

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    guard let cell = tableView.dequeueReusableCell(withIdentifier: MapsTableViewCell.reuseIdentifier, for: indexPath) as? MapsTableViewCell else {
        fatalError("Unexpected Index Path")
    }

    let map = fetchedResultsControllerForMapEntity.object(at: indexPath)
    // Configure Cell
    cell.mapNameLabel.text = map.name
    cell.button.accessibilityHint = map.name
    cell.button.addTarget(self, action: "updateMapView:", for: .touchUpInside)
    return cell
}

1 Answers1

0

Rename your method so it looks like func updateMapView(_ sender: UIButton) and use #selector(updateMapView) as your action.

Callam
  • 11,409
  • 2
  • 34
  • 32