Slide 27
Slide 27 text
class CrashlyticsErrorReporter {
private let crashlytics = Crashlytics.sharedInstance()
func report(error: Error, from reporter: Any) {
#if DEBUG
let prefix = "DEBUG "
#else
let prefix = ""
#endif
let detailedError = NSError(
domain: "\(prefix)\(type(of: reporter))",
code: CrashlyticsErrorTracker.getNSErrorCode(bySwiftError: error),
userInfo: [
NSLocalizedDescriptionKey: "\(error)",
]
)
self.crashlytics.recordError(detailedError)
}
private static func getNSErrorCode(bySwiftError error: Error) -> Int {
let bridgedError = error as NSError
return bridgedError.code
}
}
%(ϏϧυΛ۠ผͰ͖ΔΑ͏ʹ͓ͯ͘͠ͱ
ຊ൪ڥͱ։ൃڥΛ۠ผ͘͢͠ͳΔ
ΤϥʔϨϙʔλʔʹͲͷΑ͏ʹ
ूܭ͞ΕΔ͔Λҙࣝ͢Δ
ྫ͑ɺ$SBTIMZUJDT/4&SSPSͷ
EPNBJOͱDPEFͷͰΤϥʔΛ
άϧʔϐϯά͢ΔͷͰɺͦΕͧΕ
Τϥʔ*%ͱൃੜݩΛࢦఆ͢Δͱ
៉ྷʹΤϥʔ͕·ͱ·Δ
ΤϥʔͷશจάϧʔϐϯάʹΘͳ͍Α͏ʹ͢Δ
ʢϢʔβʔ*%ͱ͔͕ೖΔͱݸผͷΤϥʔʹͳͬͯ
૯ΛѲͰ͖ͳ͘ͳΔͷͰʣ
$SBTIMZUJDT༻ͷΤϥʔϨϙʔλʔΛ࡞
SFQPSUؔΛݺͿͱΤϥʔϨϙʔτ͕
ૹ৴͞ΕΔΑ͏ʹ࣮͍ͯ͠Δ
ΤϥʔͱҰॹʹൃੜݩ͕
Θ͔ΔΑ͏ʹ͓ͯ͘͠ͱ
ݪҼͷݟ͕͖ͭ͘͢ͳΔ