0

I am building a macOS project that makes use of SFSpeechRecognizer, which in turn makes use of the microphone.

Each time I modify the code and rebuild, I have to:

Preferences -> Security & Privacy -> Accessibility

Then I have to:
- click the padlock
- use my fingerprint to authorise
- uncheck and recheck my app

Now I can run.

This is because I am tapping keyboard events.

But on the first run, I am additionally, as I'm using speech recognition, presented with two dialogs:
- Authorise this application to use the microphone
- Authorise this application to send speech data to Apple

These checks came in with Catalina.

It quickly becomes very frustrating having to do this every single time I need to test something. This can easily be 100 times a day.

Is there any way to bypass these security measures during the development process?

UPDATE
I tried setting a code-sign identity with Build settings -> Signing -> Codesign Identity -> Apple Development: mySigningId... as follows:

enter image description here

I then Product -> Clean Build Folder, just as a precaution.

I then run the project, experience the dialogs, run a second time, no dialogs this time, make a minor code change the forces rebuild (adding a space somewhere, say), run again. And the dialogs are back.

Just as a sanity check, I inspect my Info.plist, and observe:

enter image description here

Is there something I'm missing?

PS If anyone can suggest more suitable tags, I'm most grateful

P i
  • 29,020
  • 36
  • 159
  • 267
  • 1
    Code sign your build. As long as your bundle ID doesn't change, macOS will "see" it as the same binary every time (for things like privacy options, keychain access, etc, etc) – TheNextman Nov 10 '19 at 04:58
  • @TheNextman, thanks for this suggestion! Unfortunately it doesn't have any effect. I've updated the question to include my tests. Am I missing something? – P i Nov 10 '19 at 17:04
  • 1
    Not sure what the problem can be, all I can say is "it works for me". The [code signing documentation](https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html) says "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" – TheNextman Nov 11 '19 at 04:28
  • Ah, it's in `Enable Development Signing`, as per https://stackoverflow.com/questions/58048969/xcode-11-0-has-entitlements-that-require-signing-with-a-development-certificate This _does_ work. I guess the straightforward `project -> signing -> ...` doesn't sign development builds... – P i Nov 12 '19 at 02:35
  • Nice. I don't have that button in Xcode 11. My project must be set up differently :) Glad to hear it works. – TheNextman Nov 12 '19 at 04:14

0 Answers0