【发布时间】:2018-03-28 14:35:45
【问题描述】:
上下文
我必须使用 Google Cloud Speech api 在 Xamarin.iOS 应用中实现 Speech to Text 功能。
音频需要在用户说话时进行流式传输,以便我们能够尽快显示用户所说的内容。
首先,我尝试使用 Google.Cloud.Speech.V1 Nuget 包,但 gRPC 库似乎不适用于 Xamarin(https://github.com/grpc/grpc/issues/1620、https://forums.xamarin.com/discussion/94534/how-to-use-google-cloud-speech-api-within-xamarin-forms、Xamarin, Grpc, Could not resolve type with token 0100002b)。
所以我尝试在这个样本上创建一个绑定:https://github.com/GoogleCloudPlatform/ios-docs-samples/tree/master/speech/Objective-C/Speech-gRPC-Streaming。
我创建了一个静态库,只保留了 SpeechRecognitionService.h 和 SpeechRecognitionService.m 文件并生成了 *.a fat 库。
问题
我必须使用 Sharpie 生成 ApiDefinition.cs。
于是我执行了命令sharpie bind -sdk iphoneos11.2 -output Output -scope . [full-path-to-SpeechRecognitionService.h]。我尝试了一些clang选项,但每次我都遇到这种错误:
Parsing 1 header files...
[full-path-to-project]/SpeechRecognitionService.h:18:9: fatal error:
'google/cloud/speech/v1/CloudSpeech.pbrpc.h' file not found
#import "google/cloud/speech/v1/CloudSpeech.pbrpc.h"
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Binding...
1 error generated.
Error while processing [full-path-to-project]/SpeechRecognitionService.h.
Done. Exiting with error code 1.
error: Clang failed to parse input and exited with code 1
似乎我必须传递一些 clang 参数来判断标题在哪里,但它们并不都在一个文件夹中。
如何让 Sharpie 在多个文件夹中搜索标题?
【问题讨论】:
标签: xamarin.ios google-cloud-speech objective-sharpie