App suddenly takes long time to launch.

I am developing a document-based app for macOS in Swift. Since Wednesday evening (28.10.2020) the app takes 57 seconds to start, before no time. The app has no sandbox and that is one reason why it launches slow, if I add the sandbox, then it starts normally, but when I then activate the 'Open File' menu item, it takes 55 second until the open dialog presents. But I would like to run without sandbox.

Without sandbox, I figured out that the time is spent between 'applicationDidFinishLaunching' and 'applicationWillTerminate'. I already removed all from DerivedData, but nothing helped. Can anyone help? Every tip is very appreciated.
Is it on the development Mac or on another Mac ?

Does it occur with a plain new project that should do nothing but open a window ?
Please check, so that you can know if that is related to the app itself.


It is on my Mac where I develop, cannot check another Mac.

I also have already created a plain new project and there are no problems.
Here is some debug output, note that Document.init is about 1 min later.

Code Block
2020-10-31 20:24:37.623130+0100 Titania[32798:1583302] applicationWillFinishLaunching
2020-10-31 20:24:37.679303+0100 Titania[32798:1583302] Metal GPU Frame Capture Enabled
2020-10-31 20:24:37.679761+0100 Titania[32798:1583302] Metal API Validation Enabled
2020-10-31 20:25:33.973460+0100 Titania[32798:1583302] Document.init
2020-10-31 20:25:34.161461+0100 Titania[32798:1583302] Document.awakeFromNib
2020-10-31 20:25:34.283840+0100 Titania[32798:1583302] applicationDidFinishLaunching

Could you get the same log with the new project ? With sandbox as well.

Have you checked (and compared) the application Signing and Capabilities to see if there is any difference ?
When I change the signing capabilities to other than (Automatically manage signing; Team: Holger Seelig; Signing Certificate: Development) then the application will crash.

Plain test app with sandbox:

Code Block
2020-10-31 22:23:29.731749+0100 Test App[33714:1651104] applicationWillFinishLaunching
2020-10-31 22:23:29.773423+0100 Test App[33714:1651104] Metal API Validation Enabled
2020-10-31 22:23:29.877980+0100 Test App[33714:1651104] Document.init
2020-10-31 22:23:29.902620+0100 Test App[33714:1651104] applicationDidFinishLaunching


Plain test app without sandbox:

Code Block
2020-10-31 22:24:43.967604+0100 Test App[33728:1652399] applicationWillFinishLaunching
2020-10-31 22:24:44.008555+0100 Test App[33728:1652399] Metal API Validation Enabled
2020-10-31 22:24:44.263754+0100 Test App[33728:1652399] Document.init
2020-10-31 22:24:44.291109+0100 Test App[33728:1652399] applicationDidFinishLaunching


Actually after I have recognized that that my app is launching slow, I have created a plain new project and copied all the files into it but then it starts slow as well.

Is your network environment changed recently?

To run sandboxed apps through Xcode, it communicates with Apple's servers depending on the app settings (especially Capabilities).
If your network environment has some difficulty in communicating with Apple's servers, or Apple's servers have some trouble, your app will launch very slow.
No, I do not change my network settings, I am fine with it. If it is the network then I would understand if it is on one a day.

With or without sandbox, I can see 0 Bytes network.

No, I do not change my network settings

I am not saying only the network settings. But if you do not want to check about networks any more, it's your decision. There may be other reasons, or may not.
In the meanwhile I figured out how to workaround this bug. I created a new project with a new name, where a new name was very important, and then everything works fine again.

I think there must be some cached data from the old project where I don't know where they are.
App suddenly takes long time to launch.
 
 
Q