zhadar
zhadar

Reputation: 81

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.

Upvotes: 7

Views: 4660

Answers (1)

kiler129
kiler129

Reputation: 1154

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: Properly configured build (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.

Upvotes: 10

Related Questions