From 3ad37fcebf0abddf172038da9fc3f4cbe5c17697 Mon Sep 17 00:00:00 2001 From: Delisa Mason Date: Tue, 21 May 2019 11:29:22 +0100 Subject: [PATCH] fix(oom): Report short version as app.version --- Source/BSGOutOfMemoryWatchdog.m | 4 ++-- features/oom.feature | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/BSGOutOfMemoryWatchdog.m b/Source/BSGOutOfMemoryWatchdog.m index dafc034de..fb7e8b416 100644 --- a/Source/BSGOutOfMemoryWatchdog.m +++ b/Source/BSGOutOfMemoryWatchdog.m @@ -155,7 +155,7 @@ - (BOOL)computeDidOOMLastLaunchWithConfig:(BugsnagConfiguration *)config { NSString *osVersion = [BSG_KSSystemInfo osBuildVersion]; NSDictionary *appInfo = [[NSBundle mainBundle] infoDictionary]; NSString *appVersion = - [appInfo valueForKey:(__bridge NSString *)kCFBundleVersionKey]; + [appInfo valueForKey:@BSG_KSSystemField_BundleShortVersion]; BOOL sameVersions = [lastBootOSVersion isEqualToString:osVersion] && [lastBootAppVersion isEqualToString:appVersion]; BOOL shouldReport = config.reportOOMs && (config.reportBackgroundOOMs || lastBootInForeground); @@ -214,7 +214,7 @@ - (NSMutableDictionary *)generateCacheInfoWithConfig:(BugsnagConfiguration *)con app[@"id"] = systemInfo[@BSG_KSSystemField_BundleID] ?: @""; app[@"name"] = systemInfo[@BSG_KSSystemField_BundleName] ?: @""; app[@"releaseStage"] = config.releaseStage; - app[@"version"] = systemInfo[@BSG_KSSystemField_BundleVersion] ?: @""; + app[@"version"] = systemInfo[@BSG_KSSystemField_BundleShortVersion] ?: @""; app[@"inForeground"] = @YES; #if TARGET_OS_TV app[@"type"] = @"tvOS"; diff --git a/features/oom.feature b/features/oom.feature index 49d251e7c..9b0b8382c 100644 --- a/features/oom.feature +++ b/features/oom.feature @@ -16,6 +16,7 @@ Feature: Reporting out of memory events And the event "severity" equals "error" And the event "severityReason.type" equals "outOfMemory" And the event "app.releaseStage" equals "beta" + And the event "app.version" equals "1.0.3" And the event breadcrumbs contain "Crumb left before crash" Scenario: The OS kills the application in the background @@ -39,6 +40,7 @@ Feature: Reporting out of memory events And the event "severity" equals "error" And the event "severityReason.type" equals "outOfMemory" And the event "app.releaseStage" equals "beta" + And the event "app.version" equals "1.0.3" And the event breadcrumbs contain "Crumb left before crash" Scenario: The OS kills the application after a session is sent