Skip to content

Commit

Permalink
Merge pull request #862 from bugsnag/5263-persist-default-version-info
Browse files Browse the repository at this point in the history
5263 persist default version info
  • Loading branch information
kstenerud authored Oct 27, 2020
2 parents e0f768f + c27d464 commit c4e3ef0
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 6 deletions.
22 changes: 16 additions & 6 deletions Bugsnag/Configuration/BugsnagConfiguration.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}

Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c4e3ef0

Please sign in to comment.