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

Crash info fixes #1215

Merged
merged 2 commits into from
Oct 22, 2021
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
3 changes: 3 additions & 0 deletions Bugsnag/BugsnagSessionTracker.m
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,9 @@ - (BOOL)resumeSession {
} else {
BOOL stopped = session.isStopped;
[session resume];
if (self.callback) {
self.callback(session);
}
[self postUpdateNotice];
return stopped;
}
Expand Down
13 changes: 8 additions & 5 deletions Bugsnag/Client/BugsnagClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,17 @@ - (instancetype)initWithConfiguration:(BugsnagConfiguration *)configuration {
if ((self = [super init])) {
// Take a shallow copy of the configuration
_configuration = [configuration copy];

if (!_configuration.user.id) { // populate with an autogenerated ID if no value set
[_configuration setUser:[BSG_KSSystemInfo deviceAndAppHash] withEmail:_configuration.user.email andName:_configuration.user.name];
}

_state = [[BugsnagMetadata alloc] initWithDictionary:@{
BSGKeyApp: @{BSGKeyIsLaunching: @YES},
BSGKeyClient: BSGDictionaryWithKeyAndObject(BSGKeyContext, _configuration.context)
BSGKeyClient: BSGDictionaryWithKeyAndObject(BSGKeyContext, _configuration.context),
BSGKeyUser: [configuration.user toJson]
}];

_notifier = configuration.notifier ?: [[BugsnagNotifier alloc] init];
self.systemState = [[BugsnagSystemState alloc] initWithConfiguration:configuration];

Expand Down Expand Up @@ -266,10 +273,6 @@ - (instancetype)initWithConfiguration:(BugsnagConfiguration *)configuration {
self.pluginClient = [[BugsnagPluginClient alloc] initWithPlugins:self.configuration.plugins
client:self];

if (self.user.id == nil) { // populate with an autogenerated ID if no value set
[self setUser:[BSG_KSSystemInfo deviceAndAppHash] withEmail:configuration.user.email andName:configuration.user.name];
}

BSGInternalErrorReporter.sharedInstance = [[BSGInternalErrorReporter alloc] initWithDataSource:self];
}
return self;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,16 @@ class BareboneTestUnhandledErrorScenario: Scenario {
}
} else {
// The version of the app at crash time.
config.addMetadata(["group": "users"], section: "user")
config.appVersion = "12.3"
config.bundleVersion = "12301"
config.context = "Something"
config.setUser("barfoo", withEmail: "[email protected]", andName: "Bar Foo")
}
super.startBugsnag()
}

override func run() {
Bugsnag.setContext("Something")
Bugsnag.setUser("barfoo", withEmail: "[email protected]", andName: "Bar Foo")
Bugsnag.addMetadata(["group": "users"], section: "user")

// Triggers "Fatal error: Unexpectedly found nil while implicitly unwrapping an Optional value: ..."
print(payload.name)
}
Expand Down