diff --git a/Bugsnag/Configuration/BugsnagConfiguration.m b/Bugsnag/Configuration/BugsnagConfiguration.m index ff6432d6b..a7e81a363 100644 --- a/Bugsnag/Configuration/BugsnagConfiguration.m +++ b/Bugsnag/Configuration/BugsnagConfiguration.m @@ -172,7 +172,6 @@ - (instancetype _Nonnull)initWithApiKey:(NSString *_Nonnull)apiKey _metadata = [[BugsnagMetadata alloc] init]; _config = [[BugsnagMetadata alloc] init]; - _bundleVersion = NSBundle.mainBundle.infoDictionary[@"CFBundleVersion"]; _endpoints = [BugsnagEndpointConfiguration new]; _sessionURL = [NSURL URLWithString:@"https://sessions.bugsnag.com"]; _autoDetectErrors = YES; @@ -203,19 +202,30 @@ - (instancetype _Nonnull)initWithApiKey:(NSString *_Nonnull)apiKey sessionWithConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; } + + NSString *releaseStage = nil; #if DEBUG - _releaseStage = BSGKeyDevelopment; + releaseStage = BSGKeyDevelopment; #else - _releaseStage = BSGKeyProduction; + releaseStage = BSGKeyProduction; #endif + NSString *appType = nil; #if BSG_PLATFORM_TVOS - _appType = @"tvOS"; + appType = @"tvOS"; #elif BSG_PLATFORM_IOS - _appType = @"iOS"; + appType = @"iOS"; #elif BSG_PLATFORM_OSX - _appType = @"macOS"; + appType = @"macOS"; + #else + appType = @"unknown"; #endif + + [self setAppType:appType]; + [self setReleaseStage:releaseStage]; + [self setAppVersion:NSBundle.mainBundle.infoDictionary[@"CFBundleShortVersionString"]]; + [self setBundleVersion:NSBundle.mainBundle.infoDictionary[@"CFBundleVersion"]]; + return self; } diff --git a/CHANGELOG.md b/CHANGELOG.md index ce7db34c9..429eeb87a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ Changelog ### Bug fixes +* Fix for incorrect version info during edge case where version info is not + manually set, and app version is changed between crashing and reporting the error. + [862](https://github.com/bugsnag/bugsnag-cocoa/pull/862) + * Catch and report unexpected exceptions when (de)serializing JSON data rather than crashing. [856](https://github.com/bugsnag/bugsnag-cocoa/pull/856)