-
-
Notifications
You must be signed in to change notification settings - Fork 342
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
fix: Reporting crashes when restarting the SDK #2440
Merged
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
a32dffd
fix: Reporting crashes when restarting the SDK
philipphofmann a3cddd7
More fixes and test buttons
philipphofmann 82ac290
fixes and tests
philipphofmann 27683ea
Fix iOS 13 sample
philipphofmann 737463a
Undo signing changes
philipphofmann 1c64a36
Fix tests
philipphofmann 809e967
Comments
philipphofmann 1f8b2a5
Clear reserved threads
philipphofmann 1230444
Check if threads are cleared
philipphofmann d5263e5
Unsubscribe from NSNotificationCenter
philipphofmann c1a43b3
Replace with TestNotificationCenter
philipphofmann 6658e27
comment out notifications
philipphofmann 53ba5a9
Add notifications again
philipphofmann 20d2f3b
Assert removeObserver
philipphofmann a20c27a
Disable set monitoring
philipphofmann 1fb6f10
Fix notification assertions
philipphofmann f70824a
Fix
philipphofmann 6a7e86b
Disable CPPException
philipphofmann 3ab8372
Disable AppState
philipphofmann 60b7ef4
Disable Mach
philipphofmann 4f81525
Disable NSException
philipphofmann eb4ebd6
Disable Signal
philipphofmann 7405e8d
Disable zombie
philipphofmann bc91046
Fix setting enabled flag
philipphofmann 1016fc6
Set reserved threads to 2
philipphofmann 295e1cb
Don't disable options
philipphofmann b372194
Don't disable options
philipphofmann 6210dbf
Refactor
philipphofmann aa93f19
Undo fix in SentrySDK
philipphofmann 91b01cb
Undo changes
philipphofmann 876ada9
Fix SentryCrashInstallationTests
philipphofmann 541f127
Undo changes
philipphofmann 23a00db
Remove crash logger file
philipphofmann 04944ca
Fix clear
philipphofmann aadecc5
Move reserved threads to mach
philipphofmann cf58530
Fix tests
philipphofmann 798179f
One more fix
philipphofmann a603d73
Undo mach setenabled
philipphofmann d86e7a0
Undo mach while enabled
philipphofmann e123106
Don't uninstall mach
philipphofmann 5a9358b
Merge branch 'master' into fix/no-crash-reports-restarting-sdk
philipphofmann 61948d6
comment
philipphofmann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taken from SentryCrashInstallation.m for testing