CGDisplayStreamCreateWithDispatchQueue returns NULL after 30 seconds

Our remote access application uses ScreenCaptureKit for capturing the screen in the user context and CGDisplayStream API as a fallback when running in the context of the Login Window.

Environment: macOS 15.0; macOS 15.1 beta; Xcode 16 The application is authorized by the user for System Screen recording.

The GUI process runs under the root user over the Login Screen. The calling thread gets stuck on CGDisplayStreamCreateWithDispatchQueue() for exactly 30 seconds. The method returns NULL afterward.

The same code worked fine on Sonoma

The problem is solved. The service that started the Screen Recording app over the Login Screen used the NSTask API with a full path to the executable inside the app bundle. The issue is gone after changing to NSWorkspace API

CGDisplayStreamCreateWithDispatchQueue returns NULL after 30 seconds
 
 
Q