我正在从当前正在运行的一个小应用程序中以Xcode获取此崩溃报告。当我在项目中打开崩溃时,我再也无法获得任何信息。
我的cellForRowAt函数如下。这是我的第一个iOS应用程序,我不确定是什么导致此崩溃。崩溃似乎是间歇性的。该应用程序可以运行数小时甚至数天而不会崩溃,然后突然崩溃,通常是在后台。
override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "eventCell", for: indexPath) as! eventTableCell
let eventData = LocationService.locationInstance.eventLogArray[indexPath.row]
let approval = eventData.approved
if approval == false {
cell.imageView?.image = UIImage(named: "unapproved")
}
else {
cell.imageView?.image = UIImage(named: "approved")
}
cell.textLabel?.text = "\(LocationService.locationInstance.eventLogArray[indexPath.row].customer) \(secondsToHoursMinutesString(seconds: Int(LocationService.locationInstance.eventLogArray[indexPath.row].duration * 60)))"
return cell
}
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
var eventData:Int
print ( LocationService.locationInstance.eventLogArray.count)
if LocationService.locationInstance.eventLogArray.count == 0 {
eventData = 0
notifyTableIsEmpty()
} else {
notifyTableNotEmpty()
eventData = LocationService.locationInstance.eventLogArray.count
}
return eventData
}
表格单元格类别:
import Foundation
import UIKit
class eventTableCell: UITableViewCell {
@IBOutlet weak var customerName: UILabel!
@IBOutlet weak var customerTime: UILabel!
}