The C based gRPC (C++, Python, Ruby, Objective-C, PHP, C#) https://grpc.io/
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Zhehao /Tony/ Lu 7c4b45de43 Little changes 5 years ago
..
auth_sample Update objc examples to use v2 API 6 years ago
helloworld Added helloworld sample with Bazel build 5 years ago
helloworld_macos Added targets for other examples in objective-c examples 5 years ago
route_guide Added targets for other examples in objective-c examples 5 years ago
BUILD Added targets for other examples in objective-c examples 5 years ago
README.md Little changes 5 years ago

README.md

gRPC in 3 minutes (Objective-C with Bazel)

To save you from reading, if you use Cocoapods and Xcode, the right reference for you is in the Hello World example directory.

Background

There are currently two ways to build projects with the gRPC Objective-C library:

  • Cocoapods & Xcode
  • Bazel

The helloworld sample is the entry point for the Cocoapods way of building projects. More is documented on grpc.io, including installation and some tutorials. They will not be reiterated here and they are not mandatory for the Bazel way.

A good place to get started with Bazel is their official website. The documentation of using gRPC Objective-C library with Bazel is here.

Installation

To run the examples in Bazel, you should have Bazel installed.

Hello Objective-C gRPC!

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

The code for the Hello World example and others live in the examples directory. Clone this repository to your local machine by running the following commands:

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

Next, change your directory to examples/objective-c

$ cd examples/objective-c

Try it!

To run the Hello World sample properly, we need a local server. Let's compile and run the corresponding C++ server:

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

Or do it the Bazel way (you might need to open another shell tab for this):

$ bazel run //examples:greeter_server

Now compile the sample:

$ bazel build :HelloWorld

To run the sample, you need to know the available simulator runtimes in your machine. You could either list the available runtimes yourself by running:

$ xcrun simctl list

Or just try running the app and it will let you know what is available in the error messages:

$ bazel run :HelloWorld

Note that running this command will build the project even if it is not built beforehand.

Finally, launch the app with one of the available runtimes:

$ bazel run :HelloWorld --ios_simulator_version='<runtime>' --ios_sumlator_device='<device>'