0
我不斯威夫特EXC_BAD_INSTRUCTION評估布爾比較
func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
if (homeChosen == true && section > 0 && indexChosen + offset == section) {
EXC_BAD_INSTRUCTIONcode = EXC_1386_INVOP_subcode 0x0
理解上的方法第一行此崩潰。
homechosen被定義爲
var indexChosen = 0
var homeChosen:Bool! at the top of the class
這是爲什麼崩潰?
隔離到:
if (indexChosen + offset == section) {
比較,如果an Int + Int == Int
崩潰。 indexChosen爲0.
indexChosen和offset的值和類型是什麼? –
也許'homeChosen'是零 – nRewik
是的,哇。布爾人決定不是假而不是假。直觀。 – quantumpotato