相关疑难解决方法(0)

什么是"致命错误:在展开可选值时意外发现nil"是什么意思?

我的Swift程序崩溃了EXC_BAD_INSTRUCTION,这个错误.它是什么意思,我该如何解决?

致命错误:在展开Optional值时意外发现nil


这篇文章旨在收集"意外发现的零"问题的答案,因此它们并不分散且难以找到.随意添加自己的答案或编辑现有的维基答案.

error-handling exception swift

390
推荐指数
7
解决办法
35万
查看次数

didSelectRowAtIndexPath无效,Swift 3

任何人都可以看到为什么世界上没有调用SelectRowAtIndexPath会被调用?我delegate在代码和故事板中都进行了三重检查.

class AddCard: UIViewController,UIPopoverPresentationControllerDelegate, UITableViewDataSource, UITableViewDelegate {

@IBOutlet weak var cardView: UIView!
@IBOutlet weak var tableView: UITableView!

let tableItems = ["Background Color","Background Image","Font Style","Font Color"]
let cellID = "cell"

override func viewDidLoad() {
    super.viewDidLoad()

    tableView.delegate = self
    tableView.dataSource = self
}

override func didReceiveMemoryWarning() {
    super.didReceiveMemoryWarning()
    // Dispose of any resources that can be recreated.
}

func setBackgroundColor (_ color: UIColor) {
    cardView.backgroundColor = color
}

func numberOfSectionsInTableView(tableView: UITableView) -> Int {
    return 1
}

func tableView(_ tableView: …
Run Code Online (Sandbox Code Playgroud)

xcode uitableview ios swift

14
推荐指数
1
解决办法
2万
查看次数

标签 统计

swift ×2

error-handling ×1

exception ×1

ios ×1

uitableview ×1

xcode ×1