Optimise iOS publihsher SDK is compatible with iOS version 6 and above.

Below are the key points covered in this guide:-

1. Download Demonstrator App and SDK

Download demonstrator app from iTunes.

Download iOS SDK 1.0.6

2. Update in this version

  • Introduced an optional setCategory() method to SDK. You can set category name to show particular category of vouchers & offers. You can check Call loadCouponWall function to use this method.

3. Overview

The following document outlines the various steps for integrating Optimise Native Content Publisher SDK. The SDK is a library used for displaying Product Feeds and Coupons, Vouchers & Offers in native apps. Developers can customise the “Product Wall” UI according to their app’s design.

4. Requirements

To add Optimise Native Content Publisher SDK you will need the latest version of Xcode (min version: IDE Xcode 5.0 for iOS application development).

5. Adding the SDK to your App

i. Drag and drop the Publisher SDK into your project

ios-productwall1

In the Dialog box click the FINISH button.

ios-productwall2

ii. Link framework to project

Click + icon of Embedded Binaries

ios-productwall3

In the Dialog box select OptimisePublisherSDK.framework and click the ADD button.

ios-productwall4

iii. Import framework into the project

#import <OptimisePublisherSDK/OptimisePublisherSDK.h>

ios-productwall5

iv. Swift support

If you are creating your app in Swift than refer Swift support for publisher SDK.

v. Create instance variable of SDKManager and Product wall

OMGSDkManager   *sdkManager;
ProductWall     *productWall;

ios-productwall6

vi. Set Global variables to SDK

//initialize instance variable of OMGSDkManager
//pass global parameters(AID, api key, api secret)
sdkManager = [OMGSDkManager sharedInstance];
[sdkManager setApiKey:@"apikey"];
[sdkManager setAID:@"aid"];
[sdkManager setApiSecret:@"apisecretkey"];
[sdkManager setMID:@"mid"]; //optional
[sdkManager setUID:@"uid"]; //optional

vii. Call loadProductWall function

ios_publisher_one

//call block method to download products data and check inside block if it returns completed "TRUE" 
//then load product wall and if return error display error message.
//pass 0 in numberOfRecords for download all data

[sdkManager loadProductWallWhereAgencyID:95 merchantID:0 minPrice:0 maxPrice:0 keyword:@"iphone" currency:@"INR" productSKU:@"" discount:NO numberOfRecords:6 completion:^(BOOL completed, NSError *error) {
if (error) {
NSLog(@"error");
}else{
if (completed) {
//initialize productWall instance variable with frame and cellType.
//if cell type is kWallCellTypeSmall or kWallCellTypeLarge set frame height 0 productWall 
//will be set height automatically according to number of parametrs.
//if cell type is kWallCellTypeCarosuel set frame height minimum 210
//if cell type is kWallCellTypeMarquee set frame height minimum 110
productWall = [[ProductWall alloc] initWithFrame: CGRectMake(0, 100, self.view.frame.size.width, 0) cellType:kWallCellTypeSmall prereductionType:KPrereductionNone];
[self.view addSubview:productWall];
[productWall reloadWall];
}
}
}];

Parameter Required? Format Description
AgencyId Yes Integer  Agency Id of the publisher
MID Yes Integer  Merchant Id – This value can be a 0 if not required
Keyword Yes String  Keyword to search for e.g. “iphone 6″
MinPrice Yes Float  The minimum price – This value can be a 0 if not required
MaxPrice Yes Float  The maximum price – This value can be a 0 if not required
Currency Yes String  3 digit ISO standard currency code
DiscountedOnly Yes Boolean  Only displays items with a discount – default value = false
ProductSKU Yes String  Display a single product by its SKU
NumberOfRecords Yes Integer  Number of records to display in product wall
CellType Yes Object  Type of product wall publisher want to display. More info.
Pre-reduction Type Yes Object This should be added as
kPrereductionNone
kPrereductionStrikethrough
kPrereductionPrefixedWas
kPrereductionPrefixedBefore

Your finished method call should look similar to the below:

ios_publisher_two

viii. Call loadCouponWall function

ios_new_load_coupon
Set category to SDK. This is also an optional method if you do not set anything than by default SDK will load all
available coupons.
If you set any value to this method than SDK will show only coupons related to that category.

 [sdkManager setCategory:@"fashion"];

Below are few categories example which you can set to SDK:-

  • Apparel and Accessories
  • Automotive
  • Beauty and Personal Care
  • Books and Stationary
  • Bus Tickets
  • Cameras and Accessories
  • Computers, Laptops and Gaming
  • Electronics
  • Entertainment
  •  Fashion
  • Flowers and Gifts
  • Food and Beverages
  • Footwear
  • Grocery
  • Health
  • Home and Decor
  • Home and Kitchen
  • Hotels
  • Industrial Supplies
  • Innerwear and Swimwear
  • Jewellery and Coins
  • Kids and Babies
  • Miscellaneous
  • Mobile Recharge and Bill Payment
  • Mobiles and Tablets
  • Musical Instruments
  • Other
  • Sports and Fitness
  • Travel and Tours
  • Utility Appliances
//call block method to download coupon data and check inside block if it returns completed "TRUE" then load Voucher wall and if return error display error message.
// start date and end date should be in dd/mm/yyyy format
[sdkManager loadCoupenWallWhereAgencyID:0 startDate:@"01/12/2015" endDate:@"01/03/2016" status:@"Active" keyword:@"paytm"  completion:^(BOOL completed, NSError *error)
if (error) {
     NSLog(@"error");
}else {
if (completed) {
    //initialize vWall instance variable with frame and cellType.
    vWall = [[VoucherWall alloc] initWithFrame:               
    CGRectMake(0, 100, self.view.frame.size.width, 0) cellType:kVoucherCellSmall];
    [self.view addSubview:vWall];
    [vWall setSpinnerColor:[UIColor redColor]]; //optional
    [vWall reloadWall]; } } }];

 

Parameter Required? Format Description
AgencyId Yes Integer Agency Id of the publisher
Status Optional String Status can be “Active”, “Pending”, “Expired” or you can leave this as empty string
cellType Yes Integer Type of product wall publisher want to display. More info.
StartDate Optional String Start date for the voucher code in dd/mm/yyyy format. This should be less than current date.
EndDate Optional String End date of the voucher code in dd/mm/yyyy format. This should not be greater than current date.

ix. Setting CellType

There are 4 different options for displaying a product wall. Choose from one of the following values:

  • Vertical wall with small cells: kWallCellTypeSmall
  • Vertical wall with large cells: kWallCellTypeLarge
  • 3D Carousel wall with large cells: kWallCellTypeCarousel
  • Marquee wall with small cells: kWallCellTypeMarquee
  • Grid view with grid cells: kWallCellTypeGrid

x. Managing Styles

You can also customise the styling according to your Application design.

Custom styling can be completed by modifying the properties of xib files.

  1. Open xib folder for the project
  2. Select xib
  3. Update the relevant properties such as background color, font size, font type, etc.

ios-productwall9

Styling container view

for example: productWall.carosuelViewContainer.backgroundColor = [UIColor  blueColor];

1