[英]Protocol buffer code compiles for iOS simulator but not device
我在我的iOS应用程序中将github.com/apple/swift-protobuf标签0.9.904和github.com/grpc/grpc-swift标签0.1.12一起使用。 我还使用与protoc相同的版本来编译我的.proto文件。
该应用程序可以在iOS模拟器中正常运行,但是当我尝试在设备上运行该应用程序时,我在myapp.pb.swift
中生成的以下代码中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问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.