Skip to content
This repository was archived by the owner on Apr 9, 2021. It is now read-only.

Commit c4c6a2b

Browse files
committed
Merge pull request #52 from LisaFC/feature/docs
Objective-C quickstart
2 parents e4e968f + 29e5d0a commit c4c6a2b

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

_layouts/docs.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
<li><a href="/docs/installation/ruby.html">Ruby</a></li>
2323
<li><a href="/docs/installation/node.html">Node.js</a></li>
2424
<li><a href="/docs/installation/csharp.html">C#</a></li>
25+
<li><a href="/docs/installation/objective-c.html">Objective-C</a></li>
2526
<li><a href="/docs/installation/php.html">PHP</a></li>
2627
<li><h4>Tutorials</h4></li>
2728
<li><a href="/docs/tutorials/basic/c.html">gRPC Basics: C++</a></li>

docs/installation/objective-c.md

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
---
2+
layout: docs
3+
title: Objective-C Quick Start
4+
---
5+
6+
<h1 class="page-header">gRPC in 3 minutes (Objective-C)</h1>
7+
8+
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).
9+
10+
## Installation
11+
12+
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).
13+
14+
## Hello Objective-C gRPC!
15+
16+
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).
17+
18+
The example code for this and our other examples lives in the `grpc-common`
19+
GitHub repository. Clone this repository to your local machine by running the
20+
following command:
21+
22+
23+
````
24+
$ git clone https://github.com/grpc/grpc-common.git
25+
```
26+
27+
Change your current directory to `grpc-common/objective-c/helloworld`
28+
29+
````
30+
$ cd grpc-common/objective-c/helloworld
31+
```
32+
33+
### Try it!
34+
To try the sample app, we need a gRPC server running locally. Let's compile and run, for example, the C++ `Greeter` server:
35+
36+
```
37+
$ pushd ../../cpp/helloworld
38+
$ make
39+
$ ./greeter_server &
40+
$ popd
41+
```
42+
43+
Now have Cocoapods generate and install the client library for our .proto files:
44+
45+
```
46+
$ pod install
47+
```
48+
49+
This might have to compile OpenSSL, which takes around 15 minutes if Cocoapods doesn't have it yet on your computer's cache).
50+
51+
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.
52+
53+
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.
54+
55+
## Tutorial
56+
57+
You can find a more detailed tutorial in [gRPC Basics: Objective-C](/docs/tutorials/basic/objective-c.html).

0 commit comments

Comments
 (0)