-
-
Notifications
You must be signed in to change notification settings - Fork 342
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Reporting crashes when restarting the SDK (#2440)
The SDK did not report crashes after restarting the SDK. This is fixed by restoring the SentryCrashMonitors when installing SentryCrash after uninstalling it.
- Loading branch information
1 parent
fb8e522
commit 9ba19c0
Showing
34 changed files
with
467 additions
and
300 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,9 +7,8 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | |
var window: UIWindow? | ||
|
||
static let defaultDSN = "https://[email protected]/5428557" | ||
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
|
||
|
||
static func startSentry() { | ||
// For testing purposes, we want to be able to change the DSN and store it to disk. In a real app, you shouldn't need this behavior. | ||
let dsn = DSNStorage.shared.getDSN() ?? AppDelegate.defaultDSN | ||
DSNStorage.shared.saveDSN(dsn: dsn) | ||
|
@@ -45,6 +44,11 @@ class AppDelegate: UIResponder, UIApplicationDelegate { | |
let httpStatusCodeRange = HttpStatusCodeRange(min: 400, max: 599) | ||
options.failedRequestStatusCodes = [ httpStatusCodeRange ] | ||
} | ||
} | ||
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
|
||
AppDelegate.startSentry() | ||
|
||
if #available(iOS 14.0, *) { | ||
metricKit.receiveReports() | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,26 +5,30 @@ import UIKit | |
class AppDelegate: UIResponder, UIApplicationDelegate { | ||
|
||
static let defaultDSN = "https://[email protected]/5428557" | ||
|
||
static func startSentry() { | ||
// For testing purposes, we want to be able to change the DSN and store it to disk. In a real app, you shouldn't need this behavior. | ||
let dsn = DSNStorage.shared.getDSN() ?? AppDelegate.defaultDSN | ||
DSNStorage.shared.saveDSN(dsn: dsn) | ||
|
||
SentrySDK.start { options in | ||
options.dsn = dsn | ||
options.beforeSend = { event in | ||
return event | ||
} | ||
options.debug = true | ||
// Sampling 100% - In Production you probably want to adjust this | ||
options.tracesSampleRate = 1.0 | ||
options.sessionTrackingIntervalMillis = 5_000 | ||
if ProcessInfo.processInfo.arguments.contains("--io.sentry.profiling.enable") { | ||
options.profilesSampleRate = 1 | ||
} | ||
} | ||
} | ||
|
||
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { | ||
|
||
// For testing purposes, we want to be able to change the DSN and store it to disk. In a real app, you shouldn't need this behavior. | ||
let dsn = DSNStorage.shared.getDSN() ?? AppDelegate.defaultDSN | ||
DSNStorage.shared.saveDSN(dsn: dsn) | ||
|
||
SentrySDK.start { options in | ||
options.dsn = dsn | ||
options.beforeSend = { event in | ||
return event | ||
} | ||
options.debug = true | ||
// Sampling 100% - In Production you probably want to adjust this | ||
options.tracesSampleRate = 1.0 | ||
options.sessionTrackingIntervalMillis = 5_000 | ||
if ProcessInfo.processInfo.arguments.contains("--io.sentry.profiling.enable") { | ||
options.profilesSampleRate = 1 | ||
} | ||
} | ||
AppDelegate.startSentry() | ||
|
||
return true | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.