【发布时间】:2017-08-21 00:31:24
【问题描述】:
我一直在创建一个 firebase 数据库,但我遇到了一个无法克服的错误。它说:
线程 1 exc_bad_instruction (code=exc_i386_invop subcode=0x0)'
这可能是一些简单的事情,我只是在回顾过去。有什么想法吗?
这是代码&错误在代码行:
//
// Database.swift
// intern
//
// Created by Lani Daniels on 8/20/17.
// Copyright © 2017 Lani Daniels. All rights reserved.
//
import UIKit
import Firebase
import FirebaseDatabase
struct PostStruct {
let title: String
let message: String
}
class DatabaseViewController: UITableViewController {
var posts: [PostStruct] = []
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableview.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
let label1 = cell.viewWithTag(1)as! UILabel
label1.text=posts[indexPath.row].title
// 错误如下:线程 1 exc_bad_instruction (code=exc_i386_invop subcode=0x0) 让 label2 = cell.viewWithTag(2)as! UIL标签 label2.text=posts[indexPath.row].message
return cell
}
}
【问题讨论】:
-
Swift 区分大小写。
-
所以,我更正了语法错误,但最终在下面一行出现错误。它说“线程 1 exc_bad_instruction (code=exc_i386_invop subcode=0x0)”知道这是什么意思吗?
-
它不能在两条线上都崩溃...告诉我们它在哪条线上崩溃?
标签: swift uitableview