I'm using Crashlytics
framework as a crash handler in may iOS app.
I need to send information of the crash to my server and to do this I implemented the delegate of [Crashlytics sharedInstance]
method called
It provides the way to handle crash report at your application start to decide whether it should send that crash report or not. Below is simplest implementation of that kind of method:
- (void)crashlyticsDidDetectReportForLastExecution:(CLSReport *)report completionHandler:(void (^)(BOOL))completionHandler {
NSDate *crashDate = report.dateCreated;
//Do the logic
completionHandler(YES);
}
To test if everything work as expected I simulated the crash using these lines
{
...
NSDate *realCrashDate = [NSDate date];
[[Crashlytics sharedInstance] crash];
}
And then I noticed that realCrashDate
that I printed in the log right before crash is different to crashDate
stored in CLSReport
instance. And the difference is even weirder because crashDate
is earlier than realCrashDate
.
Real examples are:
realCrashDate = 2016-02-15 14:36:21 +0000
crashDate = 2016-02-15 14:36:01 +0000
Does it the bug in Crashlytics
framework or it's something that I don't understand right.
I found the reason. Seems like the report.dateCreated
returns not the date of crash but the date of application session start.
This is really confusing. I guess Crashlytics team should have named it differently or at least mention it in the interface doc.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.