Commit bcb87c9
committed
fix(ios): re-attach root view after in-process runtime reload
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.1 parent 71d2203 commit bcb87c9
1 file changed
Lines changed: 39 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
331 | 331 | | |
332 | 332 | | |
333 | 333 | | |
334 | | - | |
| 334 | + | |
335 | 335 | | |
336 | 336 | | |
337 | | - | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
338 | 361 | | |
339 | 362 | | |
340 | | - | |
341 | | - | |
| 363 | + | |
342 | 364 | | |
343 | 365 | | |
344 | 366 | | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
345 | 371 | | |
346 | 372 | | |
347 | 373 | | |
| |||
360 | 386 | | |
361 | 387 | | |
362 | 388 | | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
363 | 394 | | |
364 | 395 | | |
365 | 396 | | |
366 | | - | |
367 | | - | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
368 | 401 | | |
369 | 402 | | |
370 | 403 | | |
| |||
0 commit comments