KocomojoSDK for iOS

Installation

 

Carthage

KocomojoSDK is Carthage compatible as a prebuilt framework. To install it, simply add the following line to your Cartfile:

github "KocomojoLLC/KocomojoSDK"

Add this line to your -Bridging-Header.h:

#import <KocomojoSDK/KocomojoSDK.h>

Cocoapods

KocomojoSDK is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'KocomojoSDK', '> 0.9.0'

Make sure to uncomment this line:

use_frameworks!

 

Cocoapod Gem

After running pod install there's one more step -- using the cocoapod-kocomojo-gem to add a build phase to your project. To install:

gem install cocoapods-kocomojo-sdk

then run:

pod kocomojo-sdk

If there's more than one .xcodeproj in your directory you'll need to specify it like:

pod kocomojo-sdk MyProject.xcodeproj

 

Implementation

Import KocomojoSDK.h in AppDelegate:

#import <KocomojoSDK/KocomojoSDK.h>

Add these lines in application:didFinishLaunchingWithOptions::

KocomojoSDK *sharedInstance = [KocomojoSDK sharedInstance];
[sharedInstance setApiKey:@"YOUR_API_KEY_HERE"];
[sharedInstance setRadiusInMiles:[NSNumber numberWithFloat:15.0f]];  // set it to number of miles
[sharedInstance setShowPushNotifications:YES];  // this is optional, more information below

Import KocomojoSDK into AppDelegate.swift:

import KocomojoSDK

Add these lines in application(_:didFinishLaunchingWithOptions:):

let sharedInstance: KocomojoSDK = KocomojoSDK.sharedInstance();
sharedInstance.apiKey = "YOUR_API_KEY_HERE";
sharedInstance.radiusInMiles = 15.0; // set it to number of miles
sharedInstance.showPushNotifications = true; // this is optional, more information below

 

API Key validation

You can validate your api key directly by calling

[[KocomojoSDK sharedInstance]validateApiKey:^(BOOL isValid) { ... }
KocomojoSDK.sharedInstance().validateApiKey { (valid: Bool) in ...

Alternatively you can also look for an error message in logs.

 

Experience Or Button

 

The user can enter KocomojoSDK's interface either via an Experience or a Button. Only one of the two can exist per app.

If the entire app is based on KocmomojoSDK (i.e. the first thing the user would see would be a screen designed in the editor), then you'd want to use KocomojoExperience.

If the app has existing functionality outside of KocomojoSDK, then your app will use KocomojoButton as it's entry point.

 

Go to Experience Docs  |  Go to Button Docs