diff --git a/src/objective-c/ProtoRPC/ProtoRPC.h b/src/objective-c/ProtoRPC/ProtoRPC.h index 849351720f1..33d349ce95a 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.h +++ b/src/objective-c/ProtoRPC/ProtoRPC.h @@ -84,7 +84,7 @@ NS_ASSUME_NONNULL_BEGIN * should be issued. */ - (nullable instancetype)initWithResponseHandler:(void (^)(GPBMessage *, NSError *))handler - responseDispatchQueue:(dispatch_queue_t)responseDispatchQueue; + responseDispatchQueue:(nullable dispatch_queue_t)responseDispatchQueue; /** Response headers received during the call. */ @property(readonly, nullable) NSDictionary *responseHeaders; diff --git a/src/objective-c/ProtoRPC/ProtoRPC.m b/src/objective-c/ProtoRPC/ProtoRPC.m index bd0e7d1d9c6..e73f909fd6b 100644 --- a/src/objective-c/ProtoRPC/ProtoRPC.m +++ b/src/objective-c/ProtoRPC/ProtoRPC.m @@ -38,7 +38,11 @@ responseDispatchQueue:(dispatch_queue_t)dispatchQueue { if ((self = [super init])) { _responseHandler = handler; - _responseDispatchQueue = dispatchQueue; + if (dispatchQueue == nil) { + _responseDispatchQueue = dispatchQueue; + } else { + _responseDispatchQueue = dispatch_get_main_queue(); + } } return self; }