Home

Coupon Author iOS Installation

Prerequisites

  • iOS 7+ app
  • A Coupon Author App Id from Slyce
  • Coupon Author SDK framework from Slyce

Installation

1. Get a copy of the Coupon Author SDK from Slyce. Unzip the distribution. It should contain one file: CouponAuthorSDK.framework

2. Import this framework into your XCode project by dragging it into the Project Navigator on the left-hand side.

3. Confirm that the CouponAuthor files have been imported properly:

  • Navigate to your project build settings by selecting your project's Project File in the Project Navigator
  • Select the main build target for your app
  • Select the 'Build Phases' task
  • Confirm that 'CouponAuthorSDK.framework' is in the 'Link Binary With Libraries' Section

Enabling the Coupon Author SDK in Your Project

To enable Coupon Author requires the addition of two lines to your AppDelegate file.

1. If using Objective-C:

Add the following import statement to the top of the .m file for the App Delegate:

#import <CouponAuthorSDK/CouponAuthorSDK.h>

If using Swift:

Swift projects do not use header files of their own, but they recognize header files for Objective-C libraries. You will need to create a bridging header file to connect them.

To create the header file:

  • Go to File > New > File > iOS > Source > Header File
  • Name the file 'ProjectName-Bridging-Header.h'
  • Add the following line in the #ifndef block and below the #define
#import <CouponAuthorSDK/CouponAuthorSDK.h>

To let your project point to the header file:

  • Navigate to the 'Build Settings' tab of your project build settings.
  • Navigate to 'Swift Compiler - Code Generation'
  • Ensure that 'Path/To/File/ProjectName-Bridging-Header.h' is included as an entry for 'Objective-C Bridging Header'

Important: The CouponAuthorSDK import line should be included in your App .pch file or at the top of each class where you reference the CouponAuthor SDK.

2. If using Objective-C:

Add the following line to the bottom of the didFinishLaunchingWithOptions: method of the AppDelegate.

[CouponAuthorSDK startWithAppId:@"YOUR_APP_ID"];

If using Swift:

Add the following line to the bottom of the application method.

CouponAuthorSDK.startWithAppId("YOUR_APP_ID")

Important: Make sure to fill in the parameter **startWithAppId** with your AppID, provided by us.

You should now be able to build your app and successfully use the Coupon Author API.