This application is a HelloWorld iOS sample application that connects to a HelloWorld Google Cloud Endpoints backend sample.
It relies on a copy of the Google APIs Client Library for Objective-C.
This example also uses ARC. If your application uses ARC you must set the -fno-objc-arc for the files included in the client library; see the client library project ARC notes.
-
Clone this git repo locally.
git clone https//github.com/GoogleCloudPlatform/appengine-endpoints-helloendpoints-ios.git
-
Clone a Hello Endpoints Backend sample locally and BUILD it. These instructions will assume the project was downloaded to
~/appengine-endpoints-helloendpoints-java-maven
andmvn clean install
was used to build. -
Pull down the Google Client Library Objective-C client library to a subdirectory.
cd appengine-endpints-helloendpoints-ios/Hello\ Endpoints/
svn checkout http://google-api-objectivec-client.googlecode.com/svn/trunk/ google-api-objectivec-client-read-only
-
Build the ServiceGenerator to generate an Objective-C client library.
open google-api-objectivec-client-read-only/Source/Tools/ServiceGenerator/ServiceGenerator.xcodeproj
Hit the play button to build the project. -
Generate your custom service files to work with the Google Client Library.
- Find the ServiceGenerator binary by opening Project Navigator > Products > ServiceGeneator then copying the location from the inspector on the right side of Xcode. It will typically be something like this:
/Users/<your_user_id>/Library/Developer/Xcode/DerivedData/ServiceGenerator-<random-guid>/Build/Products/Debug/ServiceGenerator
- Run the ServiceGenerator on your discovery document.
/Users/<your_user_id>/Library/Developer/Xcode/DerivedData/ServiceGenerator-<random-guid>/Build/Products/Debug/ServiceGenerator \ ~/appengine-endpoints-helloendpoints-java-maven/target/helloendpoints-1.0-SNAPSHOT/WEB-INF/helloworld-v1-rpc.discovery \ --outputDir ./API
- Find the ServiceGenerator binary by opening Project Navigator > Products > ServiceGeneator then copying the location from the inspector on the right side of Xcode. It will typically be something like this:
-
Open the Project in Xcode
open Hello\ Endpoints/Hello\ Endpoints.xcodeproj
-
Build project by hitting the play button in the top left-hand corner.
-
Modify
kMyClientId
andkMyClientSecret
inViewController.m
to include the web client ID and client secret you registered in the APIs Console. -
Modify
GTLServiceHelloworld.m
(line 44) to point to the location where you are hosting a Helloworld backend. -
Run the application.