Crashlytics
サービスレポートいくつかのクラッシュ(約30クラッシュ/ 1000のセッションのために18ユーザー)NSDateFormatter dateFromStringクラッシュ
ここに私のコード:
var brutDate: String = ""
brutDate <- map["send_date"]
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
date = dateFormatter.dateFromString(brutDate)! // here is the crash (this is line 42)
Crashlogがある。この場合、
Crashed: NSOperationQueue 0x170422a80 :: NSOperation 0x170257190 (QOS: UTILITY)
0 AppName 0x100085f84 specialized SNotification.mapping(Map) ->() (SNotification.swift:42)
1 AppName 0x100084ff4 SNotification.mapping(Map) ->() (SNotification.swift:29)
2 AppName 0x100085a78 protocol witness for Mappable.mapping(Map) ->() in conformance SNotification (SNotification.swift:29)
brutDateの値は2017-01-31 20:02:08
私はありませんアプリをクラッシュさせることはできません...
EDIT:私はフランスにあり、アプリはカナダ向けに配備されていますが、Locale
に問題がありますか?
感嘆符は、アプリをクラッシュさせる可能性があります。オプションを安全に処理する方法を学びます。 – vadian
letまたはguardがオプションのダウンキャストを処理するのになぜ使用しないのですか? – Tuhin
はいこれは他の問題であると認識しています。 date変数が設定されていない場合、日付はゼロになります。 –