Skip to content

Commit

Permalink
Merge pull request #1245 from bugsnag/PLAT-7597-start-with-api-key
Browse files Browse the repository at this point in the history
[PLAT-7597] Load config when starting with API key
  • Loading branch information
kstenerud authored Dec 2, 2021
2 parents 87bb732 + fd9997e commit f8ad95a
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Bugsnag/Bugsnag.m
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,8 @@ + (BugsnagClient *_Nonnull)start {
}

+ (BugsnagClient *_Nonnull)startWithApiKey:(NSString *_Nonnull)apiKey {
BugsnagConfiguration *configuration = [[BugsnagConfiguration alloc] initWithApiKey:apiKey];
BugsnagConfiguration *configuration = [BugsnagConfiguration loadConfig];
configuration.apiKey = apiKey;
return [self startWithConfiguration:configuration];
}

Expand Down
8 changes: 8 additions & 0 deletions features/app_and_device_attributes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ Feature: App and Device attributes present
And the error payload field "events.0.device.manufacturer" equals "Nokia"
And the error payload field "events.0.device.modelNumber" equals "0898"

Scenario: Info.plist settings are used when calling startWithApiKey
When I run "AppAndDeviceAttributesScenarioStartWithApiKey"
And I wait to receive an error
Then the error is valid for the error reporting API
And the error "Bugsnag-API-Key" header equals "12312312312312312312312312312312"

And the error payload field "events.0.app.releaseStage" equals "beta2"

Scenario: Duration value increments as expected
When I run "AppDurationScenario"
And I wait to receive 3 errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,25 @@ class AppAndDeviceAttributesScenarioCallbackOverride: Scenario {

// MARK: -

/**
* Call startWithApiKey
*/
class AppAndDeviceAttributesScenarioStartWithApiKey: Scenario {

override func startBugsnag() {
Bugsnag.start(withApiKey: "12312312312312312312312312312312")

super.startBugsnag()
}

override func run() {
let error = NSError(domain: "AppAndDeviceAttributesScenarioStartWithApiKey", code: 100, userInfo: nil)
Bugsnag.notifyError(error)
}
}

// MARK: -

class AppAndDeviceAttributesInfiniteLaunchDurationScenario: Scenario {

override func startBugsnag() {
Expand Down

0 comments on commit f8ad95a

Please sign in to comment.