我在iOS应用程序中将github.com/apple/swift-protobuf tag 0.9.904github.com/grpc/grpc-swift tag 0.1.12与Xcode一起使用。我还使用与protoc相同的版本来编译我的.proto文件。

该应用程序可以在iOS模拟器中正常运行,但是当我尝试在设备上运行该应用程序时,在myapp.pb.swift中以下生成的代码中出现编译错误:

// If the compiler emits an error on this type, it is because this file
// was generated by a version of the `protoc` Swift plug-in that is
// incompatible with the version of SwiftProtobuf to which you are linking.
// Please ensure that your are building against the same version of the API
// that was used to generate this file.
fileprivate struct _GeneratedWithProtocGenSwiftVersion: SwiftProtobuf.ProtobufAPIVersionCheck {
  struct _2: SwiftProtobuf.ProtobufAPIVersion_2 {}
  typealias Version = _2
}


错误是

No type named 'ProtobufAPIVersion_2' in module 'SwiftProtobuf'




Type '_GeneratedWithProtocGenSwiftVersion' does not conform to protocol 'ProtobufAPIVersionCheck'


对导致错误的代码段的注释不言而喻。但是,如果这是真的,为什么应用程序会在模拟器中编译并正常运行?我如何才能在设备上编译和运行它?

最佳答案

如果这仍然是您的问题,请在swift-protobuf项目上提交GitHub问题。

10-02 14:33
查看更多