Skip to content

fix(ios): prevent duplicate Application suspend/resume events when using UIScenes#11269

Merged
NathanWalker merged 1 commit into
NativeScript:mainfrom
jcassidyav:fix-UIScene-resume-suspend
Jun 16, 2026
Merged

fix(ios): prevent duplicate Application suspend/resume events when using UIScenes#11269
NathanWalker merged 1 commit into
NativeScript:mainfrom
jcassidyav:fix-UIScene-resume-suspend

Conversation

@jcassidyav

@jcassidyav jcassidyav commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

PR Checklist

What is the current behavior?

When using Scenes as per #10786 the Application resume and suspend events are fired twice ( along with other logic ).

This is because the UIApplicationDidBecomeActiveNotification & UIApplicationDidEnterBackgroundNotification notifications are fired in addition to the Scene notifications.

What is the new behavior?

If scenes are supported, then the notifications UIApplicationDidBecomeActiveNotification & UIApplicationDidEnterBackgroundNotification are not subscribed to.

The only code that is not duplicated in the scene events is the call to notifyAppStarted but this appears to the handled by the changes in #11149. The slight concern would be that the UIApplicationDidBecomeActiveNotification was handling it in some scenarios.

closes #11268

@jcassidyav jcassidyav requested a review from NathanWalker June 16, 2026 16:09
@nx-cloud

nx-cloud Bot commented Jun 16, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 7e0aa9f

Command Status Duration Result
nx test apps-automated -c=android ✅ Succeeded 5m 8s View ↗
nx run-many --target=test --configuration=ci --... ✅ Succeeded 3s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-06-16 16:18:18 UTC

@NathanWalker NathanWalker merged commit 9be95e7 into NativeScript:main Jun 16, 2026
5 checks passed
@farfromrefug

Copy link
Copy Markdown
Collaborator

@jcassidyav can you detail the concern about UIApplicationDidBecomeActiveNotification usage? If it was used in any way an issue

@jcassidyav

jcassidyav commented Jun 17, 2026

Copy link
Copy Markdown
Contributor Author

@farfromrefug when Scenes are enabled as per #10786, the notifications UISceneDidActivateNotification and UIApplicationDidBecomeActiveNotification are both fired.

In core they were both captured and executed the same code, resulting in duplicate events etc.

The decision is then which one to use, and it seems that from https://developer.apple.com/documentation/technotes/tn3187-migrating-to-the-uikit-scene-based-life-cycle the move is away from the UIApplication events, when the scene-based life cycle is enabled.

@farfromrefug

Copy link
Copy Markdown
Collaborator

@jcassidyav thanks I understand.

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.

iOS: resumeEvent and suspendEvent are triggered twice after adding UIScene-support

3 participants