viewDidAppear() called before sceneDidBecomeActive() when app is run without Xcode?

I have an odd bug. Whenever I run my app from Xcode, the order of sceneDelegate calls and view controller view lifecycle calls is different.

When I run the app from Xcode I get what I thought was the standard lifecycle order of calls: 2022-02-25 12:10:04.9980 viewWillAppear()  2022-02-25 12:10:05.0380 In sceneWillEnterForeground  2022-02-25 12:10:05.0390 In sceneDidBecomeActive()  2022-02-25 12:10:05.0410 viewDidAppear() 

But, if I take the same Xcode debug build and run it on my iPhone the view controller's viewDidAppear() is called before sceneDidBecomeActive():

2022-02-25 12:08:43.8740 viewWillAppear() 2022-02-25 12:08:43.8790 In sceneWillEnterForeground **2022-02-25 12:08:43.8810 viewDidAppear() ** 2022-02-25 12:08:44.1690 In sceneDidBecomeActive()

This happens every time. The issue I have is that since I spend most of my time in Xcode, I assumed that the order I was getting was always the same, so my code depends on that.

Why does this happen and is there a way of guaranteeing that the root controller's viewDidAppear() is called after sceneDidBecomeActive()

Thanks

If the order of lifecycle calls when the app is run directly on an iPhone is the one and true way, how can I force Xcode to use the same lifecycle sequence, so i can debug this issue? Thanks

You can't unless you get a job @apple to make the compiler changes.

You can't unless you get a job @apple to make the compiler changes.

What does this have to do with my question?

viewDidAppear() called before sceneDidBecomeActive() when app is run without Xcode?
 
 
Q