aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/objective-c
diff options
context:
space:
mode:
authorGravatar Jorge Canizales <jcanizales@google.com>2015-02-19 16:41:49 -0800
committerGravatar Jorge Canizales <jcanizales@google.com>2015-02-19 16:41:49 -0800
commitd5c1b56ddae54d887b2387b53a5d25fc015b03d8 (patch)
tree432f2953acd73e32116f3a71271de6e5ea623d91 /src/objective-c
parente379e5c100a9ee81ac4f3804811ba0e78a0b8bfb (diff)
Adds sample usage code of GRPCClient
It doesn’t build yet, because it’s missing a podspec for the C library. That’s the next thing I’m working on.
Diffstat (limited to 'src/objective-c')
-rw-r--r--src/objective-c/examples/Sample/Sample/ViewController.m18
1 files changed, 18 insertions, 0 deletions
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 {