Create a simple empty sample project. Enable Mac Catalyst. Build and run on your Mac. Now close the one window and note that the program actually terminates and the debugger session ends. Perfect.
Unfortunately my actual app doesn't terminate when the one and only app window is closed. If I close the window the program keeps running. The window is gone but it doesn't terminate. Clicking on the pause icon in the debugger and looking at the thread stacktraces doesn't show anything of my own code running.
If I pause the app every once in a while and look at the threads, while none seem to show anything really happening, new threads are being created and finshed. But these transient threads rarely show more than a single stack entry with things like "start_wqthread" or "__workq_kernreturn".
I even went so far as commenting out everything possible in the app delegate and scene delegate such that my app didn't run any code except creating an empty window with no root view controller and it still won't terminate when the (empty) window is closed. Of course the app still has a whole bunch of frameworks and pods linked in.
So I'm looking for ideas on what could possibly make an iOS app running under Mac Catalyst fail to terminate when the last window is closed.
I tried to look at the memory graph but Xcode just gives an error (Unable to acquire required taks port). But I get that with any Mac Catalyst app.
I'm stuck and this failure to terminate is causing problems.
Thanks for any ideas.