Merge pull request #20899 from muxi/update-examples

Update Objective-C examples
pull/20908/head
Muxi Yan 5 years ago committed by GitHub
commit ab7e5e8dec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 11
      examples/objective-c/helloworld/main.m
  2. 3
      examples/objective-c/helloworld_macos/main.m
  3. 10
      examples/objective-c/route_guide/ViewControllers.m

@ -21,6 +21,7 @@
#import <GRPCClient/GRPCCall+ChannelArg.h>
#import <GRPCClient/GRPCCall+Tests.h>
#import <GRPCClient/GRPCTransport.h>
#if COCOAPODS
#import <HelloWorld/Helloworld.pbrpc.h>
#else
@ -55,14 +56,12 @@ int main(int argc, char * argv[]) {
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
// this example does not use TLS (secure channel); use insecure channel instead
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
options.userAgentPrefix = @"HelloWorld/1.0";
GRPCUnaryProtoCall *call = [client sayHelloWithMessage:request
responseHandler:[[HLWResponseHandler alloc] init]
callOptions:options];
[call start];
[[client sayHelloWithMessage:request
responseHandler:[[HLWResponseHandler alloc] init]
callOptions:options] start];
return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class]));
}

@ -20,6 +20,7 @@
#import <GRPCClient/GRPCCall+ChannelArg.h>
#import <GRPCClient/GRPCCall+Tests.h>
#import <GRPCClient/GRPCTransport.h>
#if COCOAPODS
#import <HelloWorld/Helloworld.pbrpc.h>
#else
@ -54,7 +55,7 @@ int main(int argc, const char * argv[]) {
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
// this example does not use TLS (secure channel); use insecure channel instead
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
options.userAgentPrefix = @"HelloWorld/1.0";
GRPCUnaryProtoCall *call = [client sayHelloWithMessage:request

@ -23,6 +23,8 @@
#import "examples/protos/RouteGuide.pbrpc.h"
#endif
#import <GRPCClient/GRPCTransport.h>
static NSString * const kHostAddress = @"localhost:50051";
/** Category to override RTGPoint's description. */
@ -123,7 +125,7 @@ static NSString * const kHostAddress = @"localhost:50051";
[super viewDidLoad];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
_service = [[RTGRouteGuide alloc] initWithHost:kHostAddress callOptions:options];
}
@ -193,7 +195,7 @@ static NSString * const kHostAddress = @"localhost:50051";
[super viewDidLoad];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
_service = [[RTGRouteGuide alloc] initWithHost:kHostAddress callOptions:options];
}
@ -286,7 +288,7 @@ static NSString * const kHostAddress = @"localhost:50051";
[super viewDidLoad];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
_service = [[RTGRouteGuide alloc] initWithHost:kHostAddress callOptions:options];
}
@ -360,7 +362,7 @@ static NSString * const kHostAddress = @"localhost:50051";
[super viewDidLoad];
GRPCMutableCallOptions *options = [[GRPCMutableCallOptions alloc] init];
options.transportType = GRPCTransportTypeInsecure;
options.transport = GRPCDefaultTransportImplList.core_insecure;
_service = [[RTGRouteGuide alloc] initWithHost:kHostAddress callOptions:options];
}

Loading…
Cancel
Save