grpc-experiments/objective-c/helloworld
Jorge Canizales 54f4d53ea1 Update Objective-C documentation to v0.6 2015-07-17 18:06:35 -07:00
..
HelloWorld Remove unnecessary whitespace and an unused header 2015-07-17 18:06:35 -07:00
HelloWorld.xcodeproj Remove unnecessary whitespace and an unused header 2015-07-17 18:06:35 -07:00
HelloWorld.podspec Advance required gRPC of the samples to 0.6 2015-07-17 18:06:35 -07:00
Podfile Renamed HelloWorld to helloworld 2015-06-12 11:24:08 -07:00
README.md Update Objective-C documentation to v0.6 2015-07-17 18:06:35 -07:00
main.m Moved main.m up a level 2015-06-12 16:08:18 -07:00

README.md

#gRPC in 3 minutes (Objective-C)

Installation

To run this example you should have Cocoapods installed, as well as the relevant tools to generate the client library code (and a server in another language, for testing). You can obtain the latter by following these setup instructions.

Hello Objective-C gRPC!

Here's how to build and run the Objective-C implementation of the Hello World example used in Getting started.

The example code for this and our other examples lives in the grpc-common GitHub repository. Clone this repository to your local machine by running the following command:

$ git clone https://github.com/grpc/grpc-common.git

Change your current directory to grpc-common/objective-c/helloworld

$ cd grpc-common/objective-c/helloworld

Try it!

To try the sample app, we need a gRPC server running locally. Let's compile and run, for example, the C++ server in this repository:

$ pushd ../../cpp/helloworld
$ make
$ ./greeter_server &
$ popd

Now have Cocoapods generate and install the client library for our .proto files:

$ pod install

(This might have to compile OpenSSL, which takes around 15 minutes if Cocoapods doesn't have it yet on your computer's cache.)

Finally, open the XCode workspace created by Cocoapods, and run the app. You can check the calling code in main.m and see the results in XCode's log console.

The code sends a HLWHelloRequest containing the string "Objective-C" to a local server. The server responds with a HLWHelloResponse, which contains a string that is then output to the log.

Tutorial

You can find a more detailed tutorial in gRPC Basics: Objective-C.