grpc-swift: Protoc-generated swift files not compatible with SwiftGrpc (CocoaPods)

  1. I have installed in my project SwiftGrpc via CocoaPods
  2. Then I generated Swift proxy files via:
protoc <your proto files> \
    --swift_out=. \
    --swiftgrpc_out=.
  1. Then I dragged generated swift files into project, but the project doesn’t compile (see screenshot) ScreenShot

  2. When I checked handleMethod definition (from SwiftGrpc CocoaPods) I see different definition like this:

/// Handle the given method. Needs to be overridden by actual implementations.
  /// Returns whether the method was actually handled.
  open func handleMethod(_ method: String, handler: Handler, queue: DispatchQueue) throws -> Bool { fatalError("needs to be overridden") }
  1. Also HandleMethodError enum is not defined inside SwiftGrpc (CocoaPods)

Any ideas?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 2
  • Comments: 23

Most upvoted comments

Issue resolved ny updating “protoc-gen-swiftgrpc” .

Note that I do not recommend using non-SSL services in production 😉

Same problem here.

I fixed with @eaigner advise. ( Thanks 😃 )

SwiftGRPC: 0.4.2 protoc --version libprotoc 3.5.1 protoc-gen-swift --version protoc-gen-swift 1.0.3 protoc-gen-swiftgrpc --version : It doesn’t get the version so I assume it’s 1.03 too.

My project is using cocoa pods and this is the pod line in the Podile for SwiftGRPC:

pod 'SwiftGRPC', '= 0.4.2'