swiftxcodeuitableviewselfexc-bad-instruction

delegate = self causes Thread 1: exc_bad_instruction (code=exc_i386_invop subcode=0x0)


@IBOutlet weak var tableView: UITableView!

override func viewDidLoad() {
    super.viewDidLoad()

    tableView.delegate = self // error occurs here
}

Solution

  • Make sure that your @IBOutlet tableView is properly connected with interface builder.