Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions _layouts/docs.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<li><a href="/docs/installation/ruby.html">Ruby</a></li>
<li><a href="/docs/installation/node.html">Node.js</a></li>
<li><a href="/docs/installation/csharp.html">C#</a></li>
<li><a href="/docs/installation/objective-c.html">Objective-C</a></li>
<li><a href="/docs/installation/php.html">PHP</a></li>
<li><h4>Tutorials</h4></li>
<li><a href="/docs/tutorials/basic/c.html">gRPC Basics: C++</a></li>
Expand Down
57 changes: 57 additions & 0 deletions docs/installation/objective-c.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
layout: docs
title: Objective-C Quick Start
---

<h1 class="page-header">gRPC in 3 minutes (Objective-C)</h1>

This document shows you how to install and build an Objective-C client for a simple Hello World example, as used in the [Overview](/docs/index.shtml).

## Installation

To run this example you should have [Cocoapods](https://cocoapods.org/#install) 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](https://github.com/grpc/homebrew-grpc).

## Hello Objective-C gRPC!

Here's how to build and run the Objective-C implementation of the [Hello World](https://github.com/grpc/grpc-common/blob/master/protos/helloworld.proto) example used in the [Overview](/docs/index.html).

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++ `Greeter` server:

```
$ 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](/docs/tutorials/basic/objective-c.html).