【发布时间】:2015-12-18 12:40:09
【问题描述】:
我收到了一个项目,其中将 Java .proto 文件转换为 Swift 1.0。现在我将得到相同的结果,但在 Swift 2.0 中。我已阅读有关如何安装 Protobuf 编译器 (https://github.com/alexeyxo/protobuf-swift) 的说明,但在我看来它们并不清楚,这就是我有几个问题的原因:
- 他们为什么要问
Add ./src/ProtocolBuffers/ProtocolBuffers.xcodeproj in your project? -
他们在“编译“.proto”文件中询问。”使用命令
protoc person.proto --swift_out="./"是不够的。我有几个相互依赖的 .proto 文件,当我尝试为单个 .proto 文件运行此命令时,我得到以下信息:ruslans-imac:桌面 ruslan$ protoc commands.proto --swift_out="./" MobileStartup.proto:找不到文件。 TaskListPortion.proto:找不到文件。 commands.proto:导入“MobileStartup.proto”未找到或有错误。 commands.proto:导入“TaskListPortion.proto”未找到或有错误。 commands.proto:225:14:“ContainerType”未定义。 commands.proto:226:14:“FocusEnum”未定义。 commands.proto:230:14:“OffsetDateMessage”未定义。 commands.proto:231:14:“OffsetDateMessage”未定义。 commands.proto:254:14:“OffsetDateMessage”未定义。 commands.proto:279:14:未定义“LinkTypeEnum”。 commands.proto:297:14:“FocusEnum”未定义。 commands.proto:312:14:“OffsetDateTimeMessage”未定义。 commands.proto:317:14:“FocusEnum”未定义。 commands.proto:318:14:“OffsetDateMessage”未定义。 commands.proto:322:14:“FocusEnum”未定义。 commands.proto:324:14:“OffsetDateMessage”未定义。 commands.proto:344:14:“OffsetDateMessage”未定义。 commands.proto:348:14:“OffsetDateMessage”未定义。 commands.proto:352:14: "OffsetDateMessage" 未定义。
我认为应该存在某种方法来对文件进行分组并一次编译它们。
【问题讨论】:
标签: java ios swift xcode7 protocol-buffers