Make sure the app doesn't crash, if the developer forgot to delete the old PLCrashReporter framework and the framework search path is still pointing to it

If the framework search path still has the path to an older PLCrashReporter framework set and that is set before the path to HockeySDK, then it would link against the old one causing the app to crash when trying to send a bug report, because the old PLCrashReporter version is missing some new properties.
This commit is contained in:
Andreas Linde 2012-08-20 12:39:52 +02:00
parent 052b1a0bbd
commit 4707e0c8d1
2 changed files with 18 additions and 9 deletions

View File

@ -307,8 +307,10 @@
// get the startup timestamp from the crash report, and the file timestamp to calculate the timeinterval when the crash happened after startup
PLCrashReport *report = [[[PLCrashReport alloc] initWithData:crashData error:&error] autorelease];
if (report.systemInfo.timestamp && report.applicationInfo.applicationStartupTimestamp) {
_timeintervalCrashInLastSessionOccured = [report.systemInfo.timestamp timeIntervalSinceDate:report.applicationInfo.applicationStartupTimestamp];
if ([[report.applicationInfo class] respondsToSelector:@selector(applicationStartupTimestamp)]) {
if (report.systemInfo.timestamp && report.applicationInfo.applicationStartupTimestamp) {
_timeintervalCrashInLastSessionOccured = [report.systemInfo.timestamp timeIntervalSinceDate:report.applicationInfo.applicationStartupTimestamp];
}
}
}
}
@ -476,7 +478,10 @@
continue;
}
NSString *crashUUID = report.reportInfo.reportGUID ?: @"";
NSString *crashUUID = @"";
if ([[report class] respondsToSelector:@selector(reportInfo)]) {
crashUUID = report.reportInfo.reportGUID ?: @"";
}
NSString *crashLogString = [BITCrashReportTextFormatter stringValueForCrashReport:report];
if ([report.applicationInfo.applicationVersion compare:[[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]] == NSOrderedSame) {

View File

@ -169,8 +169,10 @@ static NSInteger binaryImageSort(id binary1, id binary2, void *context) {
{
NSString *reportGUID = @"[TODO]";
if (report.hasReportInfo && report.reportInfo.reportGUID != nil)
reportGUID = report.reportInfo.reportGUID;
if ([[report class] respondsToSelector:@selector(reportInfo)]) {
if (report.hasReportInfo && report.reportInfo.reportGUID != nil)
reportGUID = report.reportInfo.reportGUID;
}
NSString *hardwareModel = @"???";
if (report.hasMachineInfo && report.machineInfo.modelName != nil)
@ -553,10 +555,12 @@ static NSInteger binaryImageSort(id binary1, id binary2, void *context) {
pcOffset = frameInfo.instructionPointer - imageInfo.imageBaseAddress;
NSString *imagePath = [imageInfo.imageName stringByStandardizingPath];
NSString *appBundleContentsPath = [[report.processInfo.processPath stringByDeletingLastPathComponent] stringByDeletingLastPathComponent];
if (![imagePath isEqual: report.processInfo.processPath] && ![imagePath hasPrefix:appBundleContentsPath]) {
symbol = frameInfo.symbolName;
pcOffset = frameInfo.instructionPointer - frameInfo.symbolStart;
if ([[frameInfo class] respondsToSelector:@selector(symbolName)]) {
if (![imagePath isEqual: report.processInfo.processPath] && ![imagePath hasPrefix:appBundleContentsPath]) {
symbol = frameInfo.symbolName;
pcOffset = frameInfo.instructionPointer - frameInfo.symbolStart;
}
}
}