我从崩解剂中得到了这个令人困惑的崩溃日志,我无法理解导致我的应用崩溃的原因,有人可以帮我翻译吗?
#0. Crashed: com.apple.main-thread
0 Dev 0x10005e3a0 specialized CurrentGameViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (CurrentGameViewController.swift)
1 Dev 0x100057ce4 @objc CurrentGameViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (CurrentGameViewController.swift)
2 UIKit 0x18d5843d4 <redacted> + 716
3 UIKit 0x18d584604 <redacted> + 80
4 UIKit 0x18d571bac <redacted> + 2304
5 UIKit 0x18d5722dc <redacted> + 4144
6 UIKit 0x18d5722dc <redacted> + 4144
7 UIKit 0x18d5722dc <redacted> + 4144
8 UIKit 0x18d589668 <redacted> + 116
9 UIKit 0x18d325b14 <redacted> + 176
10 UIKit 0x18d23e54c <redacted> + 1196
11 QuartzCore 0x18a70640c -[CALayer layoutSublayers] + 148
12 QuartzCore 0x18a6fb0e8 CA::Layer::layout_if_needed(CA::Transaction*) + 292
13 QuartzCore 0x18a6fafa8 CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
14 QuartzCore 0x18a677c64 CA::Context::commit_transaction(CA::Transaction*) + 252
15 QuartzCore 0x18a69f0d0 CA::Transaction::commit() + 512
16 QuartzCore 0x18a69faf0 CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned long, void*) + 120
17 CoreFoundation 0x1873a57dc __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
18 CoreFoundation 0x1873a340c __CFRunLoopDoObservers + 372
19 CoreFoundation 0x1873a389c __CFRunLoopRun + 1024
20 CoreFoundation 0x1872d2048 CFRunLoopRunSpecific + 444
21 GraphicsServices 0x188d55198 GSEventRunModal + 180
22 UIKit 0x18d2ac628 <redacted> + 684
23 UIKit 0x18d2a7360 UIApplicationMain + 208
24 Dev 0x100058d14 main (AppDelegate.swift:16)
25 libdispatch.dylib 0x1862b45b8 (Missing)
Bellow是我在viewDidLayoutSubviews()
上调用的方法,我怀疑这可能导致此问题,但我不确定。
func checkButtonFML() {
if logoButton.superview?.subviews.last != logoButton {
logoButton.superview?.bringSubview(toFront: logoButton)
self.perform(#selector(self.checkButtonFML), with: nil, afterDelay: 0.01)
}
}
这是我的方法cellForRowAt indexPath
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.row == 0 || indexPath.row == 1 || indexPath.row == 2 || indexPath.row == 3 || indexPath.row == 4 , eventsArray.indices.contains(indexPath.row) {
let cell = tableView.dequeueReusableCell(withIdentifier: penaltyScoresCellIdentifier, for: indexPath) as! PenaltyScoresTableViewCell
if indexPath.row % 2 != 0 {
cell.backgroundColor = UIColor.white
} else {
cell.backgroundColor = UIColor(netHex: 0xEDEDED)
}
cell.layoutMargins = UIEdgeInsets.zero
cell.preservesSuperviewLayoutMargins = false
let (homeTeamEvent,gameTime,awayTeamEvent) = eventsArray[indexPath.row]
cell.homeTeamEvent.attributedText = homeTeamEvent
cell.gameTime.text = gameTime
cell.awayTeamEvent.attributedText = awayTeamEvent
cell.layoutIfNeeded()
return cell
} else {
if eventsArray.count > 5 && indexPath.row == 5, eventsArray.indices.contains(indexPath.row) {
let cell = tableView.dequeueReusableCell(withIdentifier: moreEventsCellIdentifier, for: indexPath) as! MoreEventsTableViewCell
cell.backgroundColor = UIColor.white
cell.layoutMargins = UIEdgeInsets.zero
cell.preservesSuperviewLayoutMargins = false
cell.layoutIfNeeded()
return cell
}
let cell = tableView.dequeueReusableCell(withIdentifier: gameNewsCellIdentifier, for: indexPath) as! GameNewsTableViewCell
let eventsArrayCount = eventsArray.count < 5 ? eventsArray.count : 6
let row = indexPath.row - eventsArrayCount
if let array = newsArray as [News]? , newsArray?.count > 0 {
if let date = array[row].date, let title = array[row].title , array.indices.contains(row) {
cell.title.text = title
cell.date.text = getDateFromNewsString(date)
}
if let urlString = array[row].otteluraporttiKuvat , urlString != "" , array.indices.contains(row){
let url = URL(string: urlString)
cell.poster.image = nil
cell.poster.sd_setImage(with: url, completed: { (image, error, imageCacheType, url) in
if let height = image?.size.height, let width = image?.size.width {
self.imageHeightArray.append(height)
self.imageWidthArray.append(width)
}
})
} else {
cell.poster.image = UIImage(named: "default-news-image")
}
cell.layoutMargins = UIEdgeInsets.zero
cell.preservesSuperviewLayoutMargins = false
}
cell.layoutIfNeeded()
return cell
}
}