Skip to content

Post UIApplication.willTerminateNotification before exiting the app#31

Merged
itaybre merged 2 commits into
mainfrom
itaybre/sentry_termination_handler
Aug 6, 2025
Merged

Post UIApplication.willTerminateNotification before exiting the app#31
itaybre merged 2 commits into
mainfrom
itaybre/sentry_termination_handler

Conversation

@itaybre

@itaybre itaybre commented Aug 5, 2025

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread Sources/ETDistribution.swift Outdated
// Post notification event before closing the app
NotificationCenter.default.post(name: UIApplication.willTerminateNotification, object: nil)

// Close the app after a slight delay so it has time to execute code fot the notification

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small typo here

Comment thread Example/DemoApp/UpdateUtil.swift Outdated
// Post notification event before closing the app
NotificationCenter.default.post(name: UIApplication.willTerminateNotification, object: nil)

// Close the app after a slight delay so it has time to execute code fot the notification

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and here

@itaybre itaybre merged commit 6c959b1 into main Aug 6, 2025
5 checks passed
@itaybre itaybre deleted the itaybre/sentry_termination_handler branch August 6, 2025 13:14
DispatchQueue.main.async {
UIApplication.shared.open(url) { _ in
exit(0)
// Post notification event before closing the app

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it maybe make sense to mention here that the Cocoa SDK needs this for a working watchdog termination logic. We have a soft contract here, that is very easy to break if somebody removes the delay below or posting the notification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants