diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.h b/src/objective-c/GRPCClient/private/GRPCChannel.h index de0b58ffe4ad43910b4d27b67ec79af7b6a3c726..2a7b701576a8c60a0c41b8a296ef2af15301cf07 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.h +++ b/src/objective-c/GRPCClient/private/GRPCChannel.h @@ -33,12 +33,14 @@ #import <Foundation/Foundation.h> -#include <grpc/grpc.h> +struct grpc_channel; // Each separate instance of this class represents at least one TCP connection to the provided host. // Create them using one of the subclasses |GRPCSecureChannel| and |GRPCUnsecuredChannel|. @interface GRPCChannel : NSObject -@property(nonatomic, readonly) grpc_channel *unmanagedChannel; +@property(nonatomic, readonly) struct grpc_channel *unmanagedChannel; -- (instancetype)initWithChannel:(grpc_channel *)unmanagedChannel NS_DESIGNATED_INITIALIZER; +// This initializer takes ownership of the passed channel, and will destroy it when this object is +// deallocated. It's illegal to pass the same grpc_channel to two different GRPCChannel objects. +- (instancetype)initWithChannel:(struct grpc_channel *)unmanagedChannel NS_DESIGNATED_INITIALIZER; @end diff --git a/src/objective-c/GRPCClient/private/GRPCChannel.m b/src/objective-c/GRPCClient/private/GRPCChannel.m index 49d6008fd4d4b9c0089b55c08530ca7e9d0c456a..4366e6332089cf076f5bbb0a389bb0ed8d0cd5a4 100644 --- a/src/objective-c/GRPCClient/private/GRPCChannel.m +++ b/src/objective-c/GRPCClient/private/GRPCChannel.m @@ -33,6 +33,8 @@ #import "GRPCChannel.h" +#include <grpc/grpc.h> + @implementation GRPCChannel - (instancetype)init {