Getting Started with iOS

Register and Create App

Here are the steps you need to follow in order to get started with the App42 platform

bullet Register with the App42 platform

bullet Create an App once you are on the Quick-start page (after registration)

bullet If you are already registered, login to the AppHQ console and create an App from the App Manager -> Create App link.

bullet Once the App is created, you will get an API Key/SecretKey that you will use in your app for initialization of the SDK.

Download and Set up SDK

bullet Download iOS SDK

bullet Unzip the downloaded file on your local system, the unzipped folder contains docs and a sample.

bullet Drag Shephertz_App42_iOS_API.framework into your Xcode project and drop under your project.

bullet Make sure “Copy items if needed” check-box is checked.

Add the following libraries:

CoreTelephony.framework
SystemConfiguration.framework

bullet Insert the following import statement in the Class where you want to use App42 APIs

	#import "Shephertz_App42_iOS_API/Shephertz_App42_iOS_API.h"

To use our CampaignAPI, please perform the following steps:

bullet Drag App42_iOS_CampaignAPI.framework into your Xcode project and drop under your project.

bullet You also need to add CoreLocation.framework.

bullet Add the following key value pair to your info.plist file

NSLocationWhenInUseUsageDescription : This will be used to obtain or track your location.

bullet Insert the following import statement in the Class where you want to enable Campaign API

    #import <App42_iOS_CampaignAPI/App42_iOS_CampaignAPI.h>

Initialize SDK

You have to instantiate ServiceAPI class and pass your ApiKey/SecretKey to initialize the SDK.

    [App42API initializeWithAPIKey:@"<YOUR_API_KEY>" andSecretKey:@"<YOUR_SECRET_KEY>"];

Using App42 Services

Once you have initialized your SDK with API Key/SecretKey you have to build the target service that you want to use in your App. User Service can be built using the following snippet. Similarly you can build other services with the same notation. Want to know about all the services of App42 Platform? Click Here

//Build User Service
UserService *userService = [App42API buildUserService]; 
// Using userService reference, you should be able to call all its methods like create user/update user/authenticate etc.
//Build Storage Service
StorageService *storageService = [App42API buildStorageService]; 
// Using storageService reference, you should be able to call all its methods like insert/save/update/delete etc for JSON objects.
//Similarly you can build other services like [App42API buildXXXXService].

Next

bullet Go To Creating App User for learning App User Management

OR

bullet Go To Saving App Data to learn about App Data Storage.