Ich habe Crashlytics in meine iOS App integriert. Und ich habe ein Crash-Protokoll wie dieseVerstehe ein Crashlog von Fabrics
# Issue #: 1
# Issue ID: 59940bb4be077a4dcc2837ff
# Session ID:
e68dd53b640d4ac39f21b511a9f78b78_90910b25826211e7a25d56847afe9799_0_v2
# 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: com.apple.main-thread
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
__CFRUNLOOP_IS_CALLING_OUT_TO_AN_OBSERVER_CALLBACK_FUNCTION__ + 32
16 CoreFoundation 0x18d176630 __CFRunLoopDoObservers
+ 372
17 CoreFoundation 0x18d176a7c __CFRunLoopRun + 956
18 CoreFoundation 0x18d0a6da4 CFRunLoopRunSpecific +
424
19 GraphicsServices 0x18eb11074 GSEventRunModal + 100
20 UIKit 0x193361c9c UIApplicationMain + 208
21 MY APP 0x10002f710 main
(AppDelegate.swift:16)
22 libdyld.dylib 0x18c0b559c start + 4
dies das erste Mal ist, werde ich einen Crash-Log-Datei lesen. Wie ich es verstehe. Es ist etwas falsch mit meiner Function
Klasse returnDateString
Methode 123 Zeile. Aber wie kann ich verstehen, was das genaue Problem in dieser Zeile ist? Und das ist meine Methode in der Function-Klasse.
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 = dateFormatter.date(from: dateString)
dateFormatter.dateFormat = outPutFormat///this is what you want to convert format
let timeStamp = dateFormatter.string(from: date!)
return timeStamp
}else{
return ""
}
}
Und das ist meine Linie 123. let timeStamp = dateFormatter.string(from: date!)
Was wäre der Grund dafür? Bitte helfen Sie mir. Dank
UPDATE
var inTimeArray = inTime?.components(separatedBy: ".")
print(inTimeArray)
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
Mögliches Duplikat von [DateFormatter gibt kein Datum für "HH: mm: ss"] zurück (https://Stackoverflow.com/questions/40692378/dateformatter-doesn-return-date-for-hhmmss) – the4kman
Sie am meisten wahrscheinlich "nil" in "date". Was ist dein 'inputFormat' und was ist' dateString'? Verwenden Sie keine Force-Unwrapping-Funktion, es sei denn, Sie sind zu 100%, der Wert wird niemals null sein. Zum Verständnis des Crash-Logs enthalten Crash-Logs nur einen Stack-Trace. Sie können die genaue Ursache des Problems nicht nennen, da Ihre App im Release-Modus nicht im Debugger ausgeführt wird und daher keine Breakpoints zum Abfangen und Identifizieren einer Laufzeitausnahme vorhanden sein können . Wie auch hier können Sie den Fehler in den meisten Fällen genau auf die Linie lokalisieren. –
@ DávidPásztor Ich aktualisierte meine Frage mit der Anrufzeile – user1960169