Watch 应用程序上的语音输入

Voice input on Watch app

我正在开发具有语音输入功能的应用程序 input.So 谁能告诉我如何在手表应用程序中进行语音输入。是否可以使用 siri 或任何其他选项?

你可以使用方法presentAudioRecordingControllerWithOutputURL:preset:maximumDuration:actionTitle:completion:

它创建了一个界面,允许您从 AppleWatch 设备录制音频。

Apple 网站的官方文档:

Recording Short Audio Clips

To record short audio clips, use the presentAudioRecordingControllerWithOutputURL:preset:maximumDuration:actionTitle:completion: method of WKInterfaceController to display the standard audio recording interface. When presenting the interface, you specify the audio quality you want and the location for the resulting audio file. After the user has recorded the content, the user must explicitly accept the recording before it is written to disk at the URL you specified.

For information about the audio recording options, see the description of the presentAudioRecordingControllerWithOutputURL:preset:maximumDuration:actionTitle:completion: method in WKInterfaceController Class Reference.