Since upgrading to macOS Catalina every time I run a Xcode project I get this dialog window:
Is there a way to enable the access by default or disable this security feature, so that I don't have to press this very time?
Your are re-prompted every time you recompile your application because the OS sees it as a brand new binary every time. If you code sign your binary, the OS will recognize the unchanging signature and consider the binary to be the "same" (and thus, remember your privacy choices)
From Code Signing Tasks:
Shipping and Updating Your Product The user’s system considers the new version of your product to be the same program as the previous version. For example, Keychain Services does not distinguish older and newer versions of your program as long as both are signed and the unique Identifier remains constant.
You need to sign in to Xcode (via Preferences > Accounts) using an Apple ID. A free Apple ID (as opposed to a paid Developer account) is sufficient for signing code to run locally.
In your project settings, under the "Signing and Capabilities" tab; select:
It's also possible to code sign outside of Xcode using codesign
, but I'm unsure how this works with an Apple ID.