user1960169 user1960169 - 1 year ago 51
iOS Question

Understand a crashlog from Fabrics

I have integrated crashlytics into my iOS app. And I got a crash log like this

# Issue #: 1
# Issue ID: 59940bb4be077a4dcc2837ff
# Session ID:
# Date: 2017-08-16T06:30:00Z
# OS Version: 10.3.3 (14G60)
# Device: iPhone 6s
# RAM Free: 3.8%
# Disk Free: 15.2%

#0. Crashed:
0 MY APP 0x100086b50 specialized static Functions.retunDateStringFromDateString(dateString : String, inuputFormat : String, outPutFormat : String) -> String (Functions.swift:123)
1 MY APP 0x1000ef820 specialized TeamAttendanceViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (Functions.swift)
2 MY APP 0x1000eaa78 @objc TeamAttendanceViewController.tableView(UITableView, cellForRowAt : IndexPath) -> UITableViewCell (TeamAttendanceViewController.swift)
3 UIKit 0x193641d90 -[UITableView _createPreparedCellForGlobalRow:withIndexPath:willDisplay:] + 688
4 UIKit 0x193641fa8 -[UITableView _createPreparedCellForGlobalRow:willDisplay:] + 80
5 UIKit 0x19362f6ac -[UITableView _updateVisibleCellsNow:isRecursive:] + 2152
6 UIKit 0x193646f98 -[UITableView _performWithCachedTraitCollection:] + 120
7 UIKit 0x1933df49c -[UITableView layoutSubviews] + 176
8 UIKit 0x1932f9cc0 -[UIView(CALayerDelegate) layoutSublayersOfLayer:] + 1200
9 QuartzCore 0x1904ea274 -[CALayer layoutSublayers] + 148
10 QuartzCore 0x1904dede8
CA::Layer::layout_if_needed(CA::Transaction*) + 292
11 QuartzCore 0x1904deca8
CA::Layer::layout_and_display_if_needed(CA::Transaction*) + 32
12 QuartzCore 0x19045a34c
CA::Context::commit_transaction(CA::Transaction*) + 252
13 QuartzCore 0x1904813ac
CA::Transaction::commit() + 504
14 QuartzCore 0x190481e78
CA::Transaction::observer_callback(__CFRunLoopObserver*, unsigned
long, void*) + 120
15 CoreFoundation 0x18d1789a8
16 CoreFoundation 0x18d176630 __CFRunLoopDoObservers
+ 372
17 CoreFoundation 0x18d176a7c __CFRunLoopRun + 956
18 CoreFoundation 0x18d0a6da4 CFRunLoopRunSpecific +
19 GraphicsServices 0x18eb11074 GSEventRunModal + 100
20 UIKit 0x193361c9c UIApplicationMain + 208
21 MY APP 0x10002f710 main
22 libdyld.dylib 0x18c0b559c start + 4

this is the first time I'm going to read a crash log file. As I understand. There is something wrong with my
method's 123 line. But how can I understand what is the exact issue in this line? And this is my method in the Function class.

class func retunDateStringFromDateString(dateString : String,inuputFormat: String, outPutFormat : String) -> String{
if(dateString != ""){
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = inuputFormat//this your string date format

let date = dateString)

dateFormatter.dateFormat = outPutFormat///this is what you want to convert format

let timeStamp = dateFormatter.string(from: date!)

return timeStamp
return ""


And this is my 123 line.
let timeStamp = dateFormatter.string(from: date!)

What would be the reason for this?
Please help me.


var inTimeArray = inTime?.components(separatedBy: ".")

cell.inOneTime.text = Functions.nullToNilForString(value: Functions.retunDateStringFromDateString(dateString: (inTimeArray?[0])! ,inuputFormat: "yyyy-MM-dd'T'HH:mm:ss", outPutFormat: "HH:mm") as AnyObject?)?.description

Answer Source

Based on the discussion in comments, it seems that the locale settings are different on your user's device than on your test devices and different locales can cause trouble when using explicit date formats.

As I have already stated in comments, do not force unwrap the date value, rather use optional unwrapping and show an error message to the user if String) fails.

You should either change your dateFormat to a format that is locale independent, or set dateFormatter.locale = Locale(identifier: "en_US_POSIX") or any other locale that you have tested your explicit date formats with.

As for understanding the crashlog, crash logs only show a stack trace, they cannot tell you the exact cause of the trouble, since in release mode your app is not running in debugger and hence there can be no breakpoints to catch and identify a runtime exception. However, as you did here, you can pinpoint the error to the line causing it in most cases.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download