Screen Capture permission is reset on code change when running application signed to run locally.

Originator:petik3
Number:rdar://FB9621318 Date Originated:Sep 13, 2021
Status:Open Resolved:
Product:macOS Product Version:macOS 11.5.2
Classification:Security / Privacy Reproducible:Every time
 
Created empty macOS project
Signing & Capabilities / Team - personal team
Signing & Capabilities / Signing certificate - set to "Sign to Run Locally"

The app requests Screen Capture permission in its root view controller's viewDidLoad:

CGRequestScreenCaptureAccess()

System dialog pops up, open System prefs,
Check the checkbox next to the application's name in System Preferences window.
Select Later button in popup dialog.

Rebuild the app, Screen Capture permission is granted.

Modify the code by adding a new line under CGRequestScreenCaptureAccess():
print("modified")

Rebuild and run the app.

Expected: 
The app should still have the Screen Capture privilege granted. Or if it is withdrawn, the System Preferences window should show it correctly.

Actual:
The request pop up appears again, and acts like if the permission was never granted. System Preferences shows that the app still has the permission. Permission can be regranted by checking out and back in again the permission checkbox.

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!