简体   繁体   中英

macOS Catalina screen recording permission

I am working on a screen recording app using C++ in XCode. The problem is that when I compile and start the app I always have to give permission for screen recording in "Settings > Privacy".

Is there a way to always grant the permission in XCode or sth similar? It is really annoying when developing/testing the app to always manually grant the permission when re-compiling.

Sign your debug builds Luke

In order to grant macOS "Screen Recording" permission for development (or any other permission like microphone or camera access) you must sign your debug builds with your AppleID certificate. This applies for Swift/C++/Objective-C or any other language.

It's easy and free to do:

  1. Simply click at your project
  2. Go to "Signing & Capabilities"
  3. Select "Development" in "Signing Certificate"
  4. Pick your certificate in the "Team" (if you don't have any there will be an "Add Team" button which lets you download a free one after providing your AppleID)

After that your build settings should look like that: 正确配置的构建 (you may need to go use Product -> Clean Build Folder and rebuild)

If permissions appears revoked...

Also if the system still doesn't give you permissions you need to go to system Settings -> Security & Privacy -> Privacy and under an appropriate category you need to REVOKE the permission and grant it again after rebuild. This will prompt for app quit - do it and run the application again. From now on it will always have permissions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM