I am trying to port an Applescript script which uses the SpeechRecognitionServer to an xcode project . (The script works fine when run from the Applescript editor).
I've set up a simple xcode project that executes the script when I press a command button. This all works ok until the script hits the statement:
at which point I get the error:
[AppDelegate displayName:]: Not authorized to send Apple events to SpeechRecognitionServer. (error -1743)
I've added both NSSpeechRecognitionUsageDescription and NSAppleEventsUsageDescription with suitable string prompts to my Info.plist but this seems to have no effect.
I'm not sure what else I need to do to get the script to run? I would be grateful for any help!
I've set up a simple xcode project that executes the script when I press a command button. This all works ok until the script hits the statement:
Code Block language tell application "SpeechRecognitionServer"
at which point I get the error:
[AppDelegate displayName:]: Not authorized to send Apple events to SpeechRecognitionServer. (error -1743)
I've added both NSSpeechRecognitionUsageDescription and NSAppleEventsUsageDescription with suitable string prompts to my Info.plist but this seems to have no effect.
I'm not sure what else I need to do to get the script to run? I would be grateful for any help!
Ok so the solution is: -
1/ Select the outermost folder in the Xcode project navigator pane (which will be the name of your app).
2/ In the subsequent window, select your app in the 'Targets' field (to the right of the project navigator).
3/ Select the 'Signing & Capabilities' tab.
4/ Under 'Hardened runtime->Resource Access', select 'Audio Input' and 'Apple Events'.
This, along with the aforementioned key settings in Info.plist, seems to enable the SpeechRecognitionServer.
(Note that the first time the app is run following the above changes, you will be prompted to allow the app to use the SpeechRecognitionServer - this only happens the first time).
1/ Select the outermost folder in the Xcode project navigator pane (which will be the name of your app).
2/ In the subsequent window, select your app in the 'Targets' field (to the right of the project navigator).
3/ Select the 'Signing & Capabilities' tab.
4/ Under 'Hardened runtime->Resource Access', select 'Audio Input' and 'Apple Events'.
This, along with the aforementioned key settings in Info.plist, seems to enable the SpeechRecognitionServer.
(Note that the first time the app is run following the above changes, you will be prompted to allow the app to use the SpeechRecognitionServer - this only happens the first time).