[macOS Sequoia b1-3] Screen recording permission for XPC service repeatedly requested

Hi,

my app ScreenFloat can capture screenshots and record the screen (along with system- and microphone audio). It does this in an XPC service.

On macOS Sequoia b1-3, recording does not work anymore (although permissions are granted to the app in System Preferences > Privacy & Security). Instead, I keep getting an error that my XPC service can access this computer's screen and audio. (of course, that's the point!)

First of all, the screen is locked when the warning appears, clicks anywhere on the screen are not recognized. I have to hit Escape (or wait about a minute, at which point it resolves itself), to be able to click anywhere. Clicking on Continue To Allow doesn't do anything, either. The warning just re-appears every time.

Do I need to add a new entitlement to my main app or the XPC service, or any new NSUsage strings to the InfoPlist.strings?

How can I resolve this?

Thank you,

  • Matthias
Answered by DTS Engineer in 796641022

I’m linking to this thread for context.

Perhaps it's in conjunction with me using the screencapture CLI (which I use mainly for the purpose of not having to reimplement its window-selection and on-screen-crosshair-position-and-size drawing UI).

That wouldn’t surprise me. As I’ve been saying on your other thread, the path forward here is ScreenCaptureKit.

If you (just for testing) adopt ScreenCaptureKit in your XPC service, do you still see a difference between macOS 14 and 15 beta? If so, that’s definitely bugworthy. And in that case I recommend that you file a new bug, making sure to indicate that you’re using ScreenCaptureKit and that you’ve confirmed that the bug is present in beta 3.

OTOH, if you’re only seeing this with your current code that relies on the screencapture, I don’t have a great path forward for you.


can't quote the same post twice

You can, but you have to work around a DevForums bug (r. 129474377). When you hit the quote button, you get text like this:

[quote='796438022, …']

can't quote the same post twice

[/quote]

If you remove the blank lines above and below the text you’re quoting, you can then use multiple quotes just fine.

Share and Enjoy

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

(Feedback ID: FB14071922)

P.S.: Is editing not a thing anymore in these forums?

FB14071922

Thanks for filing that. A bug report is definitely the right path forward here.

Looking at your bug, it seems that some fixes shipped in 15.0b3. However, you indicate here that you’re still seeing the problem in b3. Is that correct?


Is editing not a thing anymore in these forums?

Ah, um, negative question… tricky.

DevForums allows you to edit a post for a short time after creating it (the limit is an hour IIRC). This behaviour hasn’t changed recently.

Share and Enjoy

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

Looking at your bug, it seems that some fixes shipped in 15.0b3. However, you indicate here that you’re still seeing the problem in b3. Is that correct?

Yes, that is correct. I've submitted a sample project with the bug report demonstrating the issue. Perhaps it's in conjunction with me using the screencapture CLI (which I use mainly for the purpose of not having to reimplement its window-selection and on-screen-crosshair-position-and-size drawing UI).

Maybe it also has to do with the new System Integrity Protection for App Group containers?


(can't quote the same post twice, apparently, so in reply to your: "DevForums allows you to edit a post for a short time after creating it."

Oh, ok, thanks for clarifying. I just (wrongly, apparently) remembered being able to edit for longer. All good then.

I’m linking to this thread for context.

Perhaps it's in conjunction with me using the screencapture CLI (which I use mainly for the purpose of not having to reimplement its window-selection and on-screen-crosshair-position-and-size drawing UI).

That wouldn’t surprise me. As I’ve been saying on your other thread, the path forward here is ScreenCaptureKit.

If you (just for testing) adopt ScreenCaptureKit in your XPC service, do you still see a difference between macOS 14 and 15 beta? If so, that’s definitely bugworthy. And in that case I recommend that you file a new bug, making sure to indicate that you’re using ScreenCaptureKit and that you’ve confirmed that the bug is present in beta 3.

OTOH, if you’re only seeing this with your current code that relies on the screencapture, I don’t have a great path forward for you.


can't quote the same post twice

You can, but you have to work around a DevForums bug (r. 129474377). When you hit the quote button, you get text like this:

[quote='796438022, …']

can't quote the same post twice

[/quote]

If you remove the blank lines above and below the text you’re quoting, you can then use multiple quotes just fine.

Share and Enjoy

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

OTOH, if you’re only seeing this with your current code that relies on the screencapture, I don’t have a great path forward for you.

I understand. So what's the best way forward for replacing screencapture's selective screenshot UI? Is there a replacement for this, some asynchronous method I could call that returns the selected screen rectangle, or the selected window ID? Or do I really have to re-implement all this myself now - and re-invent the wheel - if I want to continue to sell my app on the Mac App Store (if that is even possible with public APIs, as I don't think, just as a random example, the window-highlight I get when pressing the space bar during screencapture is publicly available)? If the latter is the case, is there a temporary entitlement I could request for my app to give me more time to develop such a UI so my app continues to function in case I can't manage to develop such a replacement in time for Sequoia?

Just to keep documenting this, macOS Sequoia b4 still has this same issue.

It also affects Automator, and Shortcuts, when running a shell script calling screencapture in them - it won’t work.

So what's the best way forward for replacing screencapture's selective screenshot UI?

I don’t have all the answers for you here. This is mostly about UI, rather than security, and that’s not really my forte.

However, I do want to reiterate my previous advice: You need to explore the limits of what’s provided by ScreenCaptureKit and file enhancement requests for stuff that it can’t do.

If you have specific questions you can post ’em here — or perhaps create a new thread that’s more focused on a specific issue — and I’ll see what I can do. For example:

if that is even possible with public APIs, as I don't think, just as a random example, the window-highlight I get when pressing the space bar

I’m not sure that exactly this effect is possible, but historically you could do similar stuff using CGWindow to get the window’s bounds and then display a new transparent window on top of that.

And ScreenCaptureKit can do a lot of stuff in this space. One day I’ll have some time to play around with SCContentSharingPicker but, sadly, today is not that day.

Share and Enjoy

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

Investigating this further, I found that running
screencapture -xio ~/Desktop/test.png
from within the Terminal.app results in the same "Continue To Allow" loop as I'm experiencing in my app (Sequoia b4).
That cannot be the desired behavior, can it (bug report filed: FB14480958)?

As for ScreenCaptureKit, I am looking into it, and it does have window capturing abilities sort of reminiscent of screencapture's, but it's way clunkier, in my opinion. And it does not allow for selecting a portion of a screen to be captured (drawing a rect around the area to be captured) as far as I can tell).

On B4, the issue can easily be reproduced with Terminal.app.

With the app having Screen & System Audio Recording: screencapture -io -J window ~/Desktop/screenshot.png . It will result in the whole desktop freezing for about 30 seconds with the "Continue To Allow" privacy popup.

The issue is affecting many apps that rely on screen capture.

Thanks, Adil

The issue is affecting many apps that rely on screen capture.

There are two aspects to this:

  • User-level

  • Code-level

This thread is primarily focused on the latter. If you’re having problems with the former on the latest macOS 15 beta, the best path forward is to file a bug outlining your issue.

Please post your bug number, just for the record.

Share and Enjoy

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

Thank you, for the record here's the number FB14497258.

Adil

Sequoia b4 asks after every relaunch of the app and every restart of the Mac if I want to "Continue to allow" screen recording permissions for every app I gave it to. This is completely insane and will drive users absolutely raging mad. (FB14587060)

that is with ScreenCaptureKit

Hmmm, that’s not good.

You didn’t attach a test project to your bug report (FB14587060), so it’s not clear how you tested this. My advice on this front:

  • Create a new test app, from the macOS > App template, and try it there.

  • Make sure that app is signed with a stable code signing identity. In Xcode, I generally recommend that you enable “Automatically manage signing” in the Signing & Capabilities editor.

The second point is key. I regularly see folks build tests like this with Sign to Run Locally. The results in an ad hoc signature, which prevents TCC from doing it’s job. I explain this in more detain in TN3127 Inside Code Signing: Requirements.

Share and Enjoy

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

sample project now attached to FB14587060 . (tested it with proper signing, of course, even better, as a Developer-ID Distributed, Notarized App) (can't currently reproduce this issue after every relaunch of the app, but after every restart of the Mac, it asks and asks and asks).

Accepted Answer

Using screencapture seems to have been fixed in macOS 15b5. Of course, now that I've spent a week and a half re-implementing this stuff. Well, I guess I have a fallback now should anyone decide that screencapture is off-limits once and for all.

But don't get me wrong, I'm very glad it's working again. Thanks for all your help.

[macOS Sequoia b1-3] Screen recording permission for XPC service repeatedly requested
 
 
Q