Inherits from NSObject
Declared in SponsorPaySDK.h
SponsorPaySDK.m

Overview

Provides convenience class methods to access the functionality of the SponsorPay SDK

Tasks

Starting the SDK

Using the Mobile OfferWall

Using the Mobile Interstitial

Requesting and showing Mobile Brand Engage offers

Setting the currency name *

Determining if notifications should be shown to the user *

Accessing the Virtual Currency Server

Reporting Rewarded Actions as completed

Class Methods

VCSConnector

Returns an SPVirtualCurrencyServerConnector instance configured with the appId, userId and securityToken passed in a previous invocation of startForAppId:userId:securityToken:

+ (SPVirtualCurrencyServerConnector *)VCSConnector

Return Value

An instance of SPVirtualCurrencyServerConnector configured with the appId, userId and securityToken provided previously to the SDK start method.

Discussion

%warning%
Warning: This method expects that you’ve started the SDK through startForAppId:userId:securityToken: with a single appId - userId combination during the current session, or run, of your app. If you’ve not started the SDK yet or you’ve done it more than once with different appId - userId combinations, this method will throw an exception. If you need to use the Virtual Currency Server with more than one appId - userId combination, refer to VCSConnectorForCredentials: instead.

Declared In

SponsorPaySDK.h

VCSConnectorForCredentials:

Returns an SPVirtualCurrencyServerConnector instance configured with the appId, userId and securityToken passed in a previous invocation of startForAppId:userId:securityToken:

+ (SPVirtualCurrencyServerConnector *)VCSConnectorForCredentials:(NSString *)credentialsToken

Parameters

credentialsToken

The credentials string token returned by a previous invocation of startForAppId:userId:securityToken: whose appId, userId and securityToken will be configured in the returned SPVirtualCurrencyServerConnector instance. If you pass an invalid credentials token, this method will throw an exception.

Return Value

An instance of SPVirtualCurrencyServerConnector configured with the appId, userId and securityToken corresponding to the provided credentials token.

Declared In

SponsorPaySDK.h

brandEngageClient

Returns an SPBrandEngageClient instance configured with the appId and userId passed in a previous invocation of startForAppId:userId:securityToken:

+ (SPBrandEngageClient *)brandEngageClient

Return Value

An instance of SPBrandEngageClient configured with the appId and userId provided previously to the SDK start method.

Discussion

%warning%
Warning: This method expects that you’ve started the SDK through startForAppId:userId:securityToken: with a single appId - userId combination during the current session, or run, of your app. If you’ve not started the SDK yet or you’ve done it more than once with different appId - userId combinations, this method will throw an exception. If you need to use Mobile BrandEngage with more than one appId - userId combination, refer to brandEngageClientForCredentials: instead.

Declared In

SponsorPaySDK.h

brandEngageClientForCredentials:

Returns an SPBrandEngageClient instance configured with the appId and userId passed in a previous invocation of startForAppId:userId:securityToken:

+ (SPBrandEngageClient *)brandEngageClientForCredentials:(NSString *)credentialsToken

Parameters

credentialsToken

The credentials string token returned by a previous invocation of startForAppId:userId:securityToken: whose appId and userId will be configured in the returned SPBrandEngageClient instance. If you pass an invalid credentials token, this method will throw an exception.

Return Value

An instance of SPBrandEngageClient configured with the appId and userId corresponding to the provided credentials token.

Declared In

SponsorPaySDK.h

interstitialViewController

Returns an SPInterstitialViewController instance configured with the appId and userId passed in a previous invocation of startForAppId:userId:securityToken:

+ (SPInterstitialViewController *)interstitialViewController

Return Value

An instance of SPInterstitialViewController configured with the appId and userId provided previously to the SDK start method.

Discussion

%warning%
Warning: This method expects that you’ve started the SDK through startForAppId:userId:securityToken: with a single appId - userId combination during the current session, or run, of your app. If you’ve not started the SDK yet or you’ve done it more than once with different appId - userId combinations, this method will throw an exception. If you need to use the Interstitial with more than one appId - userId combination, refer to interstitialViewControllerForCredentials: instead.

Declared In

SponsorPaySDK.h

interstitialViewControllerForCredentials:

Returns an SPInterstitialViewController instance configured with the appId and userId passed in a previous invocation of startForAppId:userId:securityToken:

+ (SPInterstitialViewController *)interstitialViewControllerForCredentials:(NSString *)credentialsToken

Parameters

credentialsToken

The credentials string token returned by a previous invocation of startForAppId:userId:securityToken: whose appId and userId will be configured in the returned SPInterstitialViewController instance. If you pass an invalid credentials token, this method will throw an exception.

Return Value

An instance of SPInterstitialViewController configured with the appId and userId corresponding to the provided credentials token.

Declared In

SponsorPaySDK.h

offerWallViewController

Returns an SPOfferWallViewController instance configured with the appId and userId passed in a previous invocation of startForAppId:userId:securityToken:

+ (SPOfferWallViewController *)offerWallViewController

Return Value

An instance of SPOfferWallViewController configured with the appId and userId provided previously to the SDK start method.

Discussion

%warning%
Warning: This method expects that you’ve started the SDK through startForAppId:userId:securityToken: with a single appId - userId combination during the current session, or run, of your app. If you’ve not started the SDK yet or you’ve done it more than once with different appId - userId combinations, this method will throw an exception. If you need to use the OfferWall with more than one appId - userId combination, refer to offerWallViewControllerForCredentials: instead.

Declared In

SponsorPaySDK.h

offerWallViewControllerForCredentials:

Returns an SPOfferWallViewController instance configured with the appId and userId passed in a previous invocation of startForAppId:userId:securityToken:

+ (SPOfferWallViewController *)offerWallViewControllerForCredentials:(NSString *)credentialsToken

Parameters

credentialsToken

The credentials string token returned by a previous invocation of startForAppId:userId:securityToken: whose appId and userId will be configured in the returned SPOfferWallViewController instance. If you pass an invalid credentials token, this method will throw an exception.

Return Value

An instance of SPOfferWallViewController configured with the appId and userId corresponding to the provided credentials token.

Declared In

SponsorPaySDK.h

reportActionCompleted:

Reports a Rewarded Action ID as completed to the SponsorPay servers.

+ (void)reportActionCompleted:(NSString *)actionID

Parameters

actionID

The ID of the action to report as completed.

Discussion

%warning%
Warning: Action IDs can only contain capital letters, numbers, and the underscore (_) sign. If your action ID is not correctly formatted this method will throw an exception.

%warning%
Warning: This method expects that you’ve started the SDK through startForAppId:userId:securityToken: with a single appId - userId combination during the current session, or run, of your app. If you’ve not started the SDK yet or you’ve done it more than once with different appId - userId combinations, this method will throw an exception. If you need to use the SDK with ore than one appId - userId combination, refer to reportActionCompleted:forCredentials: instead.

Declared In

SponsorPaySDK.h

reportActionCompleted:forCredentials:

Reports a Rewarded Action ID as completed to the SponsorPay servers, using the appId corresponding to the passed credentials token.

+ (void)reportActionCompleted:(NSString *)actionID forCredentials:(NSString *)credentialsToken

Parameters

actionID

The ID of the action to report as completed.

credentialsToken

The credentials string token returned by a previous invocation of startForAppId:userId:securityToken:. The corresponding appId will be used to perform this request. If you pass an invalid credentials token, this method will throw an exception.

Declared In

SponsorPaySDK.h

requestBrandEngageOffersNotifyingDelegate:

Returns an SPBrandEngageClient instance configured with the appId and userId passed in a previous invocation of startForAppId:userId:securityToken: and your own delegate, and starts requesting an available BrandEngage offer immediately.

+ (SPBrandEngageClient *)requestBrandEngageOffersNotifyingDelegate:(id<SPBrandEngageClientDelegate>)delegate

Parameters

delegate

Instance of one of your classes implementing the SPBrandEngageClientDelegate protocol, which will be notified of offers availability and engagement status.

Return Value

An instance of SPBrandEngageClient configured with your delegate object and the appId and userId provided previously to the SDK start method.

Discussion

%warning%
Warning: This method expects that you’ve started the SDK through startForAppId:userId:securityToken: with a single appId - userId combination during the current session, or run, of your app. If you’ve not started the SDK yet or you’ve done it more than once with different appId - userId combinations, this method will throw an exception. If you need to use Mobile BrandEngage with more than one appId - userId combination, refer to brandEngageClientForCredentials: instead.

Declared In

SponsorPaySDK.h

requestDeltaOfCoinsNotifyingDelegate:

Requests to SponsorPay’s Virtual Currency Server the amount of coins earned by the user since the last check, notifying the provided delegate of the result.

+ (SPVirtualCurrencyServerConnector *)requestDeltaOfCoinsNotifyingDelegate:(id<SPVirtualCurrencyConnectionDelegate>)delegate

Parameters

delegate

Any object conforming to the SPVirtualCurrencyConnectionDelegate, which will be notified of the result of the request.

Return Value

The instance of SPVirtualCurrencyServerConnector that is being used to access SponsorPay’s Virtual Currency Server for this request.

Discussion

%warning%
Warning: This method expects that you’ve started the SDK through startForAppId:userId:securityToken: with a single appId - userId combination during the current session, or run, of your app. If you’ve not started the SDK yet or you’ve done it more than once with different appId - userId combinations, this method will throw an exception. If you need to use the Virtual Currency Server with more than one appId - userId combination, refer to VCSConnectorForCredentials: instead.

Declared In

SponsorPaySDK.h

setCurrencyName:

Sets the name of your virtual currency.

+ (void)setCurrencyName:(NSString *)name

Parameters

name

This is a human readable, descriptive name of your virtual currency.

Declared In

SponsorPaySDK.h

setShowPayoffNotificationOnVirtualCoinsReceived:

Whether the SDK should show a toast-like notification to the user the first time calling [SPVirtualCurrencyServerConnector fetchDeltaOfCoins] after completing an engagement returns a non-zero value.

+ (void)setShowPayoffNotificationOnVirtualCoinsReceived:(BOOL)shouldShowNotification

Parameters

shouldShowNotification

Default value is YES.

Discussion

An example notification would be @“Congratulations! You’ve earned XXX coins!!”, where ‘coins’ would be your currency name.

Declared In

SponsorPaySDK.h

showOfferWallWithParentViewController:

Presents the SponsorPay Mobile OfferWall as a child view controller of your own view controller.

+ (SPOfferWallViewController *)showOfferWallWithParentViewController:(UIViewController<SPOfferWallViewControllerDelegate> *)parent

Parameters

parent

An instance of your own UIViewController subclass that will be used as the parent view controller of the presented OfferWall. It must conform to the SPOfferWallViewControllerDelegate protocol, and will be notified whenever the OfferWall is closed.

Return Value

The instance of SPOfferWallViewController which is being presented.

Discussion

%warning%
Warning: This method expects that you’ve started the SDK through startForAppId:userId:securityToken: with a single appId - userId combination during the current session, or run, of your app. If you’ve not started the SDK yet or you’ve done it more than once with different appId - userId combinations, this method will throw an exception. If you need to use the OfferWall with more than one appId - userId combination, refer to offerWallViewControllerForCredentials: instead.

Declared In

SponsorPaySDK.h

startForAppId:userId:securityToken:

Starts the SDK, registering your credentials for all subsequent usages of the SDK functionality.

+ (NSString *)startForAppId:(NSString *)appId userId:(NSString *)userId securityToken:(NSString *)securityToken

Parameters

appId

Your SponsorPay application ID.

userId

ID of the current user of your application, or nil to have the SDK autogenerate an user ID or use a previously generated user ID.

securityToken

Security token assigned to your app ID to authenticate requests to some resources and validate their responses.

Return Value

A string token that, if you keep several sets of appId - userId combinations, can be used to refer to each one.

Discussion

%warning%
Warning: It’s necessary to call this method at least once every time your app runs in order to be able to use any other functionality of the SDK.
If you provide nil as the userId parameter the SDK will use an autogenerated user ID, which will always be the same for this installation of your app.

Declared In

SponsorPaySDK.h

startLoadingInterstitialWithParentViewController:

Attempts to load and, if available, presents the SponsorPay Interstitial as a child view controller of your own view controller.

+ (SPInterstitialViewController *)startLoadingInterstitialWithParentViewController:(UIViewController<SPInterstitialViewControllerDelegate> *)parent

Parameters

parent

An instance of your own UIViewController subclass that will be used as the parent view controller of the presented OfferWall. It must conform to the SPInterstitialViewControllerDelegate protocol, and will be notified whenever the Interstitial is closed.

Return Value

The instance of SPInterstitialViewController which is being presented.

Discussion

%warning%
Warning: This method expects that you’ve started the SDK through startForAppId:userId:securityToken: with a single appId - userId combination during the current session, or run, of your app. If you’ve not started the SDK yet or you’ve done it more than once with different appId - userId combinations, this method will throw an exception. If you need to use the Interstitial with more than one appId - userId combination, refer to interstitialViewControllerForCredentials: instead.

Declared In

SponsorPaySDK.h