Sharing a solution for a problem that took me a while to figure out.
Problem: During development of a macOS 26 app that uses ScreenCaptureKit, the screen capture permissions were being reset after every build. Each time I compiled and ran the app from Xcode, I had to re-authorize screen capture in System Settings. CGPreflightScreenCaptureAccess() would return false even though I'd just granted permission minutes ago.
Root cause: I was using ad-hoc code signing during development. macOS ties screen capture permissions to the app's code signing identity. With ad-hoc signing, the identity changes on every build, so the system treats each build as a "new" app.
Solution: Switch to an Apple Development certificate for debug builds. In Xcode:
- Build Settings → Code Signing Identity → Debug → set to "Apple Development"
- Make sure your development team is selected
After this change, the signing identity remains stable across builds, and screen capture permissions persist.
This might be related to the broader issue discussed in this forum about ScreenCapture permissions disappearing — if other developers are seeing permissions vanish, it's worth checking whether the code signing identity is changing between sessions.