GeezerVison is showing github.com — fix(ios): re-attach root view after in-process runtime reload by NathanWalker · Pull Request #11261 · NativeScript/NativeScript
Conversation
NathanWalker
commented
Jun 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
When the runtime is reloaded in-process (NativeScriptRuntime.reloadApplication, used for OTA soft reboots) the app re-runs main in a fresh JS isolate while the process stays alive. iOSApplication.run() sees a live UIApplication and routes to runAsEmbeddedApp()
- The previous UIWindow was deallocated along with the old isolate (it was retained only by the JS-side SceneDelegate._window), and sceneWillConnectToSession, which creates the window, does not re-fire on a reload. getWindow() then returned null and runAsEmbeddedApp() bailed early, leaving a black screen.
- With no embedder delegate (NativeScript owns the UIApplication), the new root was presented modally over the old, now-dead root controller instead of replacing it, leaking the old controller on every reload and breaking when an overlay is mid-presentation.
runAsEmbeddedApp() works same as before but now supports this use case:
- recreates a window bound to the active UIWindowScene when none is found (initWithWindowScene + _setWindowForScene/_setupWindowForScene);
- moves the rootViewController guard into the embedder-only branch, since a freshly recreated window has no controller yet;
- replaces the window root via setWindowRootView() for the NativeScript-owned case
Supports 9.1 runtime features for OTA installed hot reloading of runtime isolates.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
When the runtime is reloaded in-process (NativeScriptRuntime.reloadApplication,
used for OTA soft reboots) the app re-runs main in a fresh JS isolate while the
process stays alive. iOSApplication.run() sees a live UIApplication and routes
to runAsEmbeddedApp()
- The previous UIWindow was deallocated along with the old isolate (it was
retained only by the JS-side SceneDelegate._window), and
sceneWillConnectToSession — which creates the window — does not re-fire on a
reload. getWindow() then returned null and runAsEmbeddedApp() bailed early,
leaving a black screen.
- With no embedder delegate (NativeScript owns the UIApplication), the new root
was presented modally over the old, now-dead root controller instead of
replacing it — leaking the old controller on every reload and breaking when an
overlay is mid-presentation.
runAsEmbeddedApp() now:
- recreates a window bound to the active UIWindowScene when none is found
(initWithWindowScene + _setWindowForScene/_setupWindowForScene);
- moves the rootViewController guard into the embedder-only branch, since a
freshly recreated window has no controller yet;
- replaces the window root via setWindowRootView() for the NativeScript-owned
case instead of modal-presenting over the stale root.
nx-cloud
Bot
commented
Jun 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
|
View your CI Pipeline Execution ↗ for commit 6c1479b
| Command |
Status |
Duration |
Result |
nx test apps-automated -c=android |
✅ Succeeded |
3m 16s |
View ↗ |
nx run-many --target=test --configuration=ci --... |
✅ Succeeded |
<1s |
View ↗ |
💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗
☁️ Nx Cloud last updated this comment at 2026-07-20 20:58:27 UTC
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai[bot] reacted with eyes emoji
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
coderabbitai
Bot
commented
Jun 6, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
✅ Action performed
Review finished.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Looking for one thing? Review this PR in Change Stack to search files, summaries, diffs, and code without losing your place.

📝 Walkthrough
Walkthrough
This PR updates embedded NativeScript app initialization to handle missing UIWindow by recreating it bound to an active UIWindowScene, tolerate null root view controller during startup, and adjust view attachment strategies based on embedder presence versus direct owning-app mode.
Changes
Embedded app window initialization
| Layer / File(s) |
Summary |
Window recreation and view controller attachment packages/core/application/application.ios.ts |
runAsEmbeddedApp now recreates UIWindow bound to selected UIWindowScene when unavailable, tolerates null rootViewController initially, and wires view controller views differently: embedder path guards missing controller and calls setViewControllerView before delegating; owning-app path attaches NativeScript directly via setWindowRootView instead of presenting from visible view controller. |
Suggested labels
♥ community PR
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
| Check name |
Status |
Explanation |
| Title check |
✅ Passed |
The title accurately describes the main change: fixing iOS root view re-attachment after in-process runtime reload, which is the core issue addressed in the PR. |
| Description check |
✅ Passed |
The description is directly related to the changeset, explaining the problem context, technical details, and specific changes made to runAsEmbeddedApp() to support in-process runtime reloading. |
| Docstring Coverage |
✅ Passed |
No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. |
| Linked Issues check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check |
✅ Passed |
Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
📝 Generate docstrings
- Create stacked PR
- Commit on current branch
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
fix/ios-reload
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
❤️ Share
Comment @coderabbitai help to get the list of available commands and usage tips.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
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.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f2c1c242-f3f7-48bd-9baf-36cfebc2086a
📥 Commits
Reviewing files that changed from the base of the PR and between 71d2203 and bcb87c9.
📒 Files selected for processing (1)
packages/core/application/application.ios.ts
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
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.
|