I'm trying to understand a crash report I've got from crashlytics which looks like this:
Crashed: com.apple.main-thread
0 App 0x104076730 RaceViewController.tableView(_:cellForRowAt:) + 4369164080 (<compiler-generated>:4369164080)
1 App 0x104076800 @objc RaceViewController.tableView(_:cellForRowAt:) + 4369164288 (<compiler-generated>:4369164288)
2 UIKitCore 0x1b6039b24 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 736
3 UIKitCore 0x1b6007870 -[UITableView _updateVisibleCellsNow:] + 2500
4 UIKitCore 0x1b60245d8 -[UITableView layoutSubviews] + 160
5 UIKitCore 0x1b62f785c -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 2144
6 QuartzCore 0x1b888a724 -[CALayer layoutSublayers] + 284
7 QuartzCore 0x1b889087c CA::Layer::layout_if_needed(CA::Transaction*) + 468
8 QuartzCore 0x1b889b3c0 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 140
9 QuartzCore 0x1b87e3f1c CA::Context::commit_transaction(CA::Transaction*, double) + 296
10 QuartzCore 0x1b880d8bc CA::Transaction::commit() + 676
11 UIKitCore 0x1b5e6ca30 _afterCACommitHandler + 140
12 CoreFoundation 0x1b1d1a06c __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
13 CoreFoundation 0x1b1d14f60 __CFRunLoopDoObservers + 420
14 CoreFoundation 0x1b1d153dc __CFRunLoopRun + 968
15 CoreFoundation 0x1b1d14ce8 CFRunLoopRunSpecific + 424
16 GraphicsServices 0x1bbe5f38c GSEventRunModal + 160
17 UIKitCore 0x1b5e43444 UIApplicationMain + 1932
18 App 0x104066764 main + 13 (Race.swift:13)
19 libdyld.dylib 0x1b1b9c8f0 start + 4
I can see points to two places, RaceViewController.tableView(_:cellForRowAt:)
& Race.swift:13
.
Lets look at those two places in the code:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let day = self.days[indexPath.section]
var totalIndex = 0
var raceIndex = 0
for selectedRace in racesByDay[day]! {
if (totalIndex == indexPath.row) {
let cell = tableView.dequeueReusableCell(withIdentifier: "raceCell")! as! RaceCell
cell.delegate = self
cell.populate(event: self.event!, selectableRace: self.racesByDay[day]![raceIndex])
return cell
}
if selectedRace.opened {
if (indexPath.row <= totalIndex + selectedRace.race.classes.count) {
let cell = tableView.dequeueReusableCell(withIdentifier: "competitorClassCell")! as! CompetitorClassCell
cell.delegate = self
cell.populate(competitorClass: selectedRace.race.classes[indexPath.row - totalIndex - 1], selectableRace: selectedRace)
return cell
}
totalIndex += selectedRace.race.classes.count
} else {
totalIndex += 1
}
raceIndex += 1
}
return tableView.dequeueReusableCell(withIdentifier: "raceCell")!
}
and Race.swift:
import UIKit
import SwiftyJSON
class Race {
var id: String <-- this is line 13
var name: String
var viewerUrl: String
var trackingStartTime: Date
var trackingEndTime: Date
var expectedStartDate: String
var raceStarttime: Date?
var mapPublicationTime: Date?
var initialized: Bool
...
}
How can I understand where the crash happened with this information? I'm not able to reproduce the crash.