1、报错(编译报错,代码无提示报错)
项目编译提示的两个报错内容:
- Command CompileSwift failed with a nonzero exit code
- error: Abort trap: 6
2、解决。
通过查看编译报错的内容,发现可能是tableViewCell出问题。
原来代码:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: cellID, for: indexPath)
guard let cell = cell as? HPListTableViewCell else { return cell }
return cell
}
解决编译报错后的代码:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let defCell = tableView.dequeueReusableCell(withIdentifier: cellID, for: indexPath)
guard let cell = defCell as? HPListTableViewCell else { return defCell }
return cell
}