0 Replies
      Latest reply on Dec 26, 2019 11:56 AM by Rulovic
      Rulovic Level 1 Level 1 (0 points)

        Hello all,

        I have an application which needs to take screenshots. The application runs with no UI. That application is launched by GUI agent which controls that is running all the time.

        On Catalina the app is not able to take screenshots anymore, only empty background. If I am right this is due to not having screen recording permission.

        I have found this code to force the app to show the popup asking for screen recording permission

        CGDisplayStreamRef stream = CGDisplayStreamCreate(CGMainDisplayID(), 1, 1, kCVPixelFormatType_32BGRA, nil,
                  ^(CGDisplayStreamFrameStatus status, uint64_t displayTime, IOSurfaceRef frameSurface, CGDisplayStreamUpdateRef updateRef) {});

         

        but it does not work. I do not see the popup.

        However if I run the application from command line I see the popup asking Screen Recoding permission for Terminal, not for the app itself, but in this case I can see the screenshots (after rebooting the app though)

        Could someone tell me or give me some advices how to achieve what I need, please? I would like to keep previous architecture (agent controlling app is running and display Screen Recording permissions popup)

         

         

        Edit:

        =============

        In case someone faces same problem I found the solution I was invoking scripts using shell. I changed my shell to zsh and it started working.

        (My shell was zsh as it is the default shell in Catalina).

        What I am still seeing which is bit weird is that the application asking for permission is "env" instead of name of my app. Could someone explain why that happens?

         

        Thanks in advance