【发布时间】:2017-02-12 15:23:50
【问题描述】:
我遇到了一个除了致命错误之外没有其他信息的崩溃。我可以在 Xcode 的“组织者”中看到它,它指向以下行:
我无法在我工作的设备或模拟器上重现它。当有人使用 TestFlight 的测试版时,就会发生这种情况。
#0 (null) in specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never ()
#1 (null) in specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt, flags : UInt32) -> Never ()
#2 (null) in ...TableViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell at ...TableViewController.swift:103
更多代码:
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cellIdentifier = "LCell"
let cell = tableView.dequeueReusableCell(withIdentifier: cellIdentifier, for: indexPath) as! LTableViewCell
let l = ls[(indexPath as NSIndexPath).row]
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = NSLocalizedString("dd/MM/yyyy", comment: "")
if let date = l.date{
let dateString = dateFormatter.string(from: date)
cell.dateLabel.text = dateString
}
【问题讨论】:
-
你能提供更多代码吗?
-
@Asdrubal 我编辑了我的问题
-
如果 l.date != nil 则尝试
-
ls是如何声明的? -
@TimVermeulen 在类大括号中:
var ls: [LObject] = []然后在 viewDidLoad 我从 Core Data 获取列表。
标签: ios swift xcode crash fatal-error