Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

5263 persist default version info #862

Merged
merged 1 commit into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]];
nickdowell marked this conversation as resolved.
Show resolved Hide resolved
[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