getting a Crash in crashlytics. However, the user's app on the device does NOT actually crash. Everything works as expected.
Heres is the stack trace:
Crashed: com.apple.main-thread
0 DigiDeals 0x33404 specialized Universal.displayMessages() + 4302730244 (:4302730244)
1 DigiDeals 0x32840 specialized Universal.displayMessages() + 453 (Universal.swift:453)
2 libswift_Concurrency.dylib 0x4d764 swift::runJobInEstablishedExecutorContext(swift::Job*) + 436
3 libswift_Concurrency.dylib 0x4e9c8 swift_job_runImpl(swift::Job*, swift::ExecutorRef) + 72
4 libdispatch.dylib 0x124b4 _dispatch_main_queue_drain + 748
5 libdispatch.dylib 0x121b8 _dispatch_main_queue_callback_4CF + 44
6 CoreFoundation 0x56710 CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE + 16
7 CoreFoundation 0x53914 __CFRunLoopRun + 1996
8 CoreFoundation 0x52cd8 CFRunLoopRunSpecific + 608
9 GraphicsServices 0x11a8 GSEventRunModal + 164
10 UIKitCore 0x40a90c -[UIApplication _run] + 888
11 UIKitCore 0x4be9d0 UIApplicationMain + 340
12 UIKitCore 0x638384 keypath_get_selector_hoverStyle + 11024
13 DigiDeals 0x4aaf8 main + 4302826232 (AppDelegate.swift:4302826232)
14 ??? 0x1c2bd5e4c (Missing)
Post
Replies
Boosts
Views
Activity
I am trying to keep the tableVies scroll position when I come back into my screen. I am getting this error:
Terminating app due to uncaught exception 'NSRangeException', reason: 'Attempted to scroll the table view to an out-of-bounds row (7) when there are only 4 rows in section 0.
There should be 10 rows in section 0. I think that the tableView is not fully loaded and that's why the error says there is only 1 row in section 0 because this crash doesn't occur most of the time. Usually it works fine. Variable savedRowMainFave is saved in viewWillDisappear
I put some print statements to show values:
Leaving indexPath = [0, 7]. (this is in the viewWillDisappear(). Prints savedRowMainFave = (dealsTable.indexPathsForVisibleRows?.last) ?? savedRowMainFave)
filteredDeals.count = 10 (also in the viewWillAppear() this is the number of items in the array that populates the tableView called dealsTable)
this is the calculated rows = 10 (also in the viewWillAppear() this prints self.dealsTable.numberOfRows(inSection: savedRowMainFave.section))
This code scrolls to the saved position. The if statement is supposed to protect from crashing but is obviously self.dealsTable.numberOfRows(inSection: savedRowMainFave.section) is not working
if (self.dealsTable.numberOfRows(inSection: savedRowMainFave.section) > savedRowMainFave.row){
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) {self.dealsTable.scrollToRow(at: savedRowMainFave, at: .bottom, animated: false)
}
Any suggestions for ways of verifying a valid savedRowMainIndex ( an indexPath) would be greatly appreciated. Thanks