[AppDelegate applicationDidFinishLaunching:] is not called in the login window immediately after the OS of macOS Catalina is started

I'm making a program that works as an agent on macOS.
The language is Objective-C.
It is created with XCode based on "app" of "macOS".

The plist is placed in /Library/LaunchAgents, and its LimitLoadToSessionType is Aqua and LoginWindow.

When I call NSApplicationMain() in main function, I expect [AppDelegate applicationDidFinishLaunching:] to be called.

However, in macOS Catalina, after calling NSApplicationMain() in the login window immediately after the OS starts,
[AppDelegate applicationDidFinishLaunching:] is not called.

It has been confirmed that if you log in once and then log off, it works as expected.

With macOS Mojave, both immediately after OS startup and when logging off after login, it worked as expected.

Why does this behavior occur immediately after the OS of macOS Catalina is started?
Also, please let me know if there is a way to avoid this behavior.
Answered by DTS Engineer in 622510022
I had cause to look at this today. This seems to a new variant of a bug (r. 5636091) that’s documented in the read me for the PreLoginAgents, except that this variant affects normal window server connections, not just the ones used by CGEventTap. If anyone else hits this, please open a DTS tech support incident so we can talk about workarounds.

I filed a new bug to track this variant of the issue (r. 65934301).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"

However, in macOS Catalina, after calling NSApplicationMain in the login window immediately after the OS starts, -[AppDelegate applicationDidFinishLaunching:] is not called.

Do you have FileVault enabled?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Hello eskimo.

Do you have FileVault enabled?

No. FileVault is disabled.

FileVault is disabled.

Hmmm, that rules out the only obvious cause that I can think of. Beyond that, if this is causing you significant grief, I recommend that you open a DTS tech support incident so that I can allocate time to look into it in depth.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Accepted Answer
I had cause to look at this today. This seems to a new variant of a bug (r. 5636091) that’s documented in the read me for the PreLoginAgents, except that this variant affects normal window server connections, not just the ones used by CGEventTap. If anyone else hits this, please open a DTS tech support incident so we can talk about workarounds.

I filed a new bug to track this variant of the issue (r. 65934301).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
[AppDelegate applicationDidFinishLaunching:] is not called in the login window immediately after the OS of macOS Catalina is started
 
 
Q