0

My app is working fine for every device and simulator me and my testers checked with. but it crashed for a specific user. I got the crash log from his device but couldn't understand the reason for crash.

Here is my Crash Log:

Date/Time:           2018-07-25 11:41:53.4778 -0700
Launch Time:         2018-07-25 11:41:49.3381 -0700
OS Version:          iPhone OS 11.4 (15F79)
Baseband Version:    1.93.00
Report Version:      104

Exception Type:  EXC_CRASH (SIGABRT)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Exception Note:  EXC_CORPSE_NOTIFY
Triggered by Thread:  0

Application Specific Information:
abort() called

Filtered syslog:
None found

Last Exception Backtrace:
0   CoreFoundation                  0x184786d8c __exceptionPreprocess + 228
1   libobjc.A.dylib                 0x1839405ec objc_exception_throw + 55
2   CoreFoundation                  0x18471fd80 -[__NSSingleObjectArrayI objectAtIndex:] + 127
3   UIKit                           0x18ecfdaa8 -[UITableViewDataSource tableView:cellForRowAtIndexPath:] + 171
4   UIKit                           0x18ea160f4 -[UITableViewController tableView:cellForRowAtIndexPath:] + 67
5   UIKit                           0x18e4600cc -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 667
6   UIKit                           0x18e45fd84 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 79
7   UIKit                           0x18e45eaa0 -[UITableView _updateVisibleCellsNow:isRecursive:] + 2279
8   UIKit                           0x18e45a5ec -[UITableView layoutSubviews] + 139
9   UIKit                           0x18e3976f4 -[UIView+ 308980 (CALayerDelegate) layoutSublayersOfLayer:] + 1419
10  QuartzCore                      0x18890dfec -[CALayer layoutSublayers] + 183
11  QuartzCore                      0x18891217c CA::Layer::layout_if_needed+ 1208700 (CA::Transaction*) + 323
12  QuartzCore                      0x18887e830 CA::Context::commit_transaction+ 604208 (CA::Transaction*) + 319
13  QuartzCore                      0x1888a6364 CA::Transaction::commit+ 766820 () + 579
14  UIKit                           0x18e655598 _afterCACommitHandler + 255
15  CoreFoundation                  0x18472e910 __CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 31
16  CoreFoundation                  0x18472c238 __CFRunLoopDoObservers + 411
17  CoreFoundation                  0x18472c884 __CFRunLoopRun + 1435
18  CoreFoundation                  0x18464cda8 CFRunLoopRunSpecific + 551
19  GraphicsServices                0x186631020 GSEventRunModal + 99
20  UIKit                           0x18e669758 UIApplicationMain + 235
21  Visits                          0x1021b5418 main + 21528 (Location+CoreDataClass.swift:15)
22  libdyld.dylib                   0x1840ddfc0 start + 3

And (Location+CoreDataClass.swift:15) file has following code

10 import Foundation
11 import CoreData
12 import CoreLocation
13
14 @objc(Location)
15 public class Location: NSManagedObject {
16    
17    @objc var coordinate : CLLocationCoordinate2D {
18        get{
19            return CLLocationCoordinate2D(latitude: self.latitude, longitude: self.longitude)
20        }
21    }

Code for my tableView datasource:

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    guard let sectionInfo = fetchedResultController.sections?[section] else {
        return 0
    }
    return sectionInfo.numberOfObjects
}

func numberOfSections(in tableView: UITableView) -> Int {
    guard let sections = fetchedResultController.sections else{
        return 0
    }
    return sections.count
}


func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {

    let cell = tableView.dequeueReusableCell(withIdentifier: visitCellIdentifier, for: indexPath)
    configure(cell: cell, for: indexPath)
    return cell
}

Need to know the reason of crash. I have been testing this app for more than a month but haven't got this crash. But this user is not even able to start the app.

FE_Tech
  • 1,534
  • 13
  • 25
  • App Crashed in cellForRow of tableview and reason may be your array in your Visits class – Prashant Tukadiya Jul 27 '18 at 05:21
  • seems to be an array index out of bounds crash. Check is there any scenario the data source for your tableview may contain less than the number of items expected – ManuRaphy Jul 27 '18 at 05:24
  • maybe this can help you [this link](https://stackoverflow.com/questions/3536276/how-to-diagnose-exc-crash) – Ketan Odedra Jul 27 '18 at 05:26
  • put a break point at [tableView:cellForRowAtIndexPath] ans check your datasource array count and cell index, and array value . – vivekDas Jul 27 '18 at 05:30
  • I have two tableViews in my app. One is using fetchedResultsController as data source and other one doesn't have a data source since it is a static tableView and designed in Interface builder. – FE_Tech Jul 27 '18 at 05:31
  • Your crash log similar to this. It has few solution follow [link](https://stackoverflow.com/questions/40663384/nssingleobjectarrayi-objectatindex-index-18446744073709551615-beyond-b) – Shankar Shinde Jul 27 '18 at 05:32
  • @vivekDas I am not able to replicate this crash. The app is working fine for me. Even after reinstalling the app. – FE_Tech Jul 27 '18 at 05:32
  • If you are not able to reproduce the crash, for now you can put a condition as IndexPath.row < YourArray.count before accessing the dataSource array. – vivekDas Jul 27 '18 at 05:40
  • @vivekDas I am using a FetchedResultsController and I added the code for my datasource. – FE_Tech Jul 27 '18 at 05:45
  • Can you provide your [configure(cell: cell, for: indexPath)] method to check. – vivekDas Jul 27 '18 at 05:53
  • @vivekDas If it was a problem with configure cell, It would appear in backtrace. – FE_Tech Jul 27 '18 at 06:08
  • Seems your fetchedResultsController data source fetching from coredata the data is not proper or index is out of bound. Check your DB table data and count. – vivekDas Jul 27 '18 at 06:19
  • Assuming that cellForIndexPath is returning nil.. Seems that function tableView.dequeueReusableCell(withIdentifier: visitCellIdentifier, for: indexPath) is the only line which can return nil, but I have my cell registered with cell identifier. Any idea in which other case it can return nil? – FE_Tech Jul 27 '18 at 09:01

0 Answers0