From d5c1b56ddae54d887b2387b53a5d25fc015b03d8 Mon Sep 17 00:00:00 2001 From: Jorge Canizales <jcanizales@google.com> Date: Thu, 19 Feb 2015 16:41:49 -0800 Subject: [PATCH] Adds sample usage code of GRPCClient MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It doesn’t build yet, because it’s missing a podspec for the C library. That’s the next thing I’m working on. --- .../examples/Sample/Sample/ViewController.m | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/objective-c/examples/Sample/Sample/ViewController.m b/src/objective-c/examples/Sample/Sample/ViewController.m index 70b5d45811..f24d81888b 100644 --- a/src/objective-c/examples/Sample/Sample/ViewController.m +++ b/src/objective-c/examples/Sample/Sample/ViewController.m @@ -32,6 +32,10 @@ */ #import "ViewController.h" +#import <GRPCClient/GRPCCall.h> +#import <GRPCClient/GRPCMethodName.h> +#import <RxLibrary/GRXWriter+Immediate.h> +#import <RxLibrary/GRXWriteable.h> @interface ViewController () @@ -42,6 +46,20 @@ - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. + + GRPCMethodName *method = [[GRPCMethodName alloc] initWithPackage:@"grpc.testing" + interface:@"TestService" + method:@"EmptyCall"]; + + GRPCCall *call = [[GRPCCall alloc] initWithHost:@"localhost" + method:method + requestsWriter:[GRXWriter writerWithValue:[NSData data]]]; + + [call startWithWriteable:[[GRXWriteable alloc] initWithValueHandler:^(NSData *value) { + NSLog(@"Received response: %@", value); + } completionHandler:^(NSError *errorOrNil) { + NSLog(@"Finished with error: %@", errorOrNil); + }]]; } - (void)didReceiveMemoryWarning { -- GitLab