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

  • Register with the App42 platform
  • Create an App once you are on the Quick-start page (after registration)
  • If you are already registered, login to the AppHQ console and create an App from the App Manager -> Create App link.
  • 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
  • Download iOS SDK
  • Unzip the downloaded file on your local system, the unzipped folder contains docs and a sample.
  • Drag Shephertz_App42_iOS_API.framework into your Xcode project and drop under your project.
  • Make sure “Copy items if needed” check-box is checked.

Add the following libraries:

CoreTelephony.framework
SystemConfiguration.framework

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:

  • Drag App42_iOS_CampaignAPI.framework into your Xcode project and drop under your project.
  • You also need to add CoreLocation.framework.
  • Add the following key value pair to your info.plist file
NSLocationWhenInUseUsageDescription : This will be used to obtain or track your location.

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].

Go To Creating App User for learning App User Management

OR

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