Tapjoy Class Reference

Inherits from NSObject
Declared in Tapjoy.h

Overview

The Tapjoy Connect Main class. This class provides all publicly available methods for developers to integrate Tapjoy into their applications.

Other Methods

  sdkKey

The application SDK key unique to this app.

@property (nonatomic, copy) NSString *sdkKey

Discussion

The application SDK key unique to this app.

Declared In

Tapjoy.h

  appID

The application ID unique to this app.

@property (nonatomic, copy) NSString *appID

Discussion

The application ID unique to this app.

Declared In

Tapjoy.h

  secretKey

The Tapjoy secret key for this applicaiton.

@property (nonatomic, copy) NSString *secretKey

Discussion

The Tapjoy secret key for this applicaiton.

Declared In

Tapjoy.h

  userID

The user ID, a custom ID set by the developer of an app to keep track of its unique users.

@property (nonatomic, copy) NSString *userID

Discussion

The user ID, a custom ID set by the developer of an app to keep track of its unique users.

Declared In

Tapjoy.h

  plugin

The name of the plugin used. If no plugin is used, this value is set to “native” by default.

@property (nonatomic, copy) NSString *plugin

Discussion

The name of the plugin used. If no plugin is used, this value is set to “native” by default.

Declared In

Tapjoy.h

  currencyMultiplier

The currency multiplier value, used to adjust currency earned.

@property (nonatomic, assign) float currencyMultiplier

Discussion

The currency multiplier value, used to adjust currency earned.

Declared In

Tapjoy.h

+ connect:

This method is called to initialize the Tapjoy system and notify the server that this device is running your application.

+ (void)connect:(NSString *)sdkKey

Parameters

sdkKey

The application SDK Key. Retrieved from the app dashboard in your Tapjoy account.

Return Value

n/a

Discussion

This method is called to initialize the Tapjoy system and notify the server that this device is running your application.

This method should be called upon app delegate initialization in the applicationDidFinishLaunching method.

Declared In

Tapjoy.h

+ connect:options:

This method is called to initialize the Tapjoy system and notify the server that this device is running your application.

+ (void)connect:(NSString *)sdkKey options:(NSDictionary *)optionsDict

Parameters

sdkKey

The application SDK Key. Retrieved from the app dashboard in your Tapjoy account.

options

NSDictionary of special flags to enable non-standard settings. Valid key:value options:

TJC_OPTION_ENABLE_LOGGING : BOOL to enable logging

TJC_OPTION_USER_ID : NSString user id that must be set if your currency is not managed by Tapjoy. If you don’t have a user id on launch you can call setUserID later

TJC_OPTION_DISABLE_GENERIC_ERROR_ALERT : BOOL to disable our default error dialogs

TJC_OPTION_MEDIATION_TIMEOUT: int used to set custom timeout interval for mediated requests (seconds)

Return Value

n/a

Discussion

This method is called to initialize the Tapjoy system and notify the server that this device is running your application.

This method should be called upon app delegate initialization in the applicationDidFinishLaunching method.

Declared In

Tapjoy.h

+ isConnected

Helper function to check if SDK is initialized

+ (BOOL)isConnected

Discussion

Helper function to check if SDK is initialized

Declared In

Tapjoy.h

+ getSupportURL

This method returns URL to Tapjoy support web page. This will use your default currency.

+ (NSString *)getSupportURL

Return Value

URL of Tapjoy support web page

Discussion

This method returns URL to Tapjoy support web page. This will use your default currency.

Declared In

Tapjoy.h

+ getSupportURL:

This method returns the URL to Tapjoy support web page for specified currency You can get your currencyID from the Tapjoy Dashboard under the currency section.

+ (NSString *)getSupportURL:(NSString *)currencyID

Parameters

currencyID

the app’s currency id

Return Value

URL of Tapjoy support web page for specified currency

Discussion

This method returns the URL to Tapjoy support web page for specified currency You can get your currencyID from the Tapjoy Dashboard under the currency section.

Declared In

Tapjoy.h

+ setDebugEnabled:

This method enables/disables the debug mode of the SDK.

+ (void)setDebugEnabled:(BOOL)enabled

Parameters

enabled

true to enable, false to disable

Return Value

n/a

Discussion

This method enables/disables the debug mode of the SDK.

Declared In

Tapjoy.h

+ startSession

This method is called to track the session manually. If this method called, automatic session tracking will be disabled.

+ (void)startSession

Return Value

n/a

Discussion

This method is called to track the session manually. If this method called, automatic session tracking will be disabled.

Declared In

Tapjoy.h

+ endSession

This method is called to track the session manually. If this method called, automatic session tracking will be disabled.

+ (void)endSession

Return Value

n/a

Discussion

This method is called to track the session manually. If this method called, automatic session tracking will be disabled.

Declared In

Tapjoy.h

+ setAppDataVersion:

This method is called to set data version of your application.

+ (void)setAppDataVersion:(NSString *)appDataVarsion

Parameters

appDataVersion

The application data version.

Return Value

n/a

Discussion

This method is called to set data version of your application.

Declared In

Tapjoy.h

+ setApplicationLaunchingOptions:

This method is called to set LaunchOptions. Call this method in application:didFinishLaunchingWithOptions: NOTE: From 11.2.2, you don’t have to call this method.

+ (void)setApplicationLaunchingOptions:(NSDictionary *)launchOptions

Parameters

launchOptions

the same parameter that passed on application:didFinishLaunchingWithOptions:

Discussion

This method is called to set LaunchOptions. Call this method in application:didFinishLaunchingWithOptions: NOTE: From 11.2.2, you don’t have to call this method.

Declared In

Tapjoy.h

+ setReceiveRemoteNotification:

This method is called to set RemoteNotificationUserInfo. Call this method in application:didReceiveRemoteNotification:

+ (void)setReceiveRemoteNotification:(NSDictionary *)userInfo

Parameters

userInfo

the same parameter that passed on application:didReceiveRemoteNotification:

Discussion

This method is called to set RemoteNotificationUserInfo. Call this method in application:didReceiveRemoteNotification:

Declared In

Tapjoy.h

+ setDeviceToken:

This method is called to send APN device token to Tapjoy server.

+ (void)setDeviceToken:(NSData *)deviceToken

Parameters

deviceToken

the same parameter that passed on application:didRegisterForRemoteNotificationsWithDeviceToken:

Return Value

n/a

Discussion

This method is called to send APN device token to Tapjoy server.

Declared In

Tapjoy.h

+ setDefaultViewController:

Sets the default UIViewController to show a content of the placement having no specific view controller given.

+ (void)setDefaultViewController:(UIViewController *)viewController

Discussion

Sets the default UIViewController to show a content of the placement having no specific view controller given.

Warning: This is experimental and only applicable to contents of “Push to Earn” or the default placements so far.

Declared In

Tapjoy.h

+ setUserLevel:

This method is called to set the level of the user.

+ (void)setUserLevel:(int)userLevel

Return Value

n/a

Discussion

This method is called to set the level of the user.

@param userLevel the level of the user

Declared In

Tapjoy.h

+ setUserFriendCount:

This method is callled to sets the friends count of the user.

+ (void)setUserFriendCount:(int)friendCount

Parameters

friendCount

the number of friends

Return Value

n/a

Discussion

This method is callled to sets the friends count of the user.

Declared In

Tapjoy.h

+ setUserCohortVariable:value:

This method is called to set a variable of the cohort.

+ (void)setUserCohortVariable:(int)index value:(NSString *)value

Parameters

index

the index of the cohort to set (1,2,3,4,5)

value

the value of the property to set

Return Value

n/a

Discussion

This method is called to set a variable of the cohort.

Declared In

Tapjoy.h

+ getUserTags

Returns a string set which contains tags on the user.

+ (NSSet *)getUserTags

Return Value

set of string

Discussion

Returns a string set which contains tags on the user.

Declared In

Tapjoy.h

+ setUserTags:

Sets tags for the user.

+ (void)setUserTags:(NSSet *)tags

Parameters

tags

the tags to be set can have up to 200 tags where each tag can have 200 characters

Discussion

Sets tags for the user.

Declared In

Tapjoy.h

+ clearUserTags

Removes all tags from the user.

+ (void)clearUserTags

Discussion

Removes all tags from the user.

Declared In

Tapjoy.h

+ addUserTag:

Adds the given tag to the user if it is not already present.

+ (void)addUserTag:(NSString *)tag

Parameters

tag

the tag to be added

Discussion

Adds the given tag to the user if it is not already present.

Declared In

Tapjoy.h

+ removeUserTag:

Removes the given tag from the user if it is present.

+ (void)removeUserTag:(NSString *)tag

Parameters

tag

the tag to be removed

Discussion

Removes the given tag from the user if it is present.

Declared In

Tapjoy.h

+ trackPurchase:currencyCode:price:campaignId:transactionId:

This method is called to track the purchase.

+ (void)trackPurchase:(NSString *)productIdentifier currencyCode:(NSString *)currencyCode price:(double)price campaignId:(NSString *)campaignId transactionId:(NSString *)transactionId

Parameters

productIdentifier

the identifier of product

currencyCode

the currency code of price as an alphabetic currency code specified in ISO 4217, i.e. “USD”, “KRW”

price

the price of product

campaignId

the campaign id of the purchase request which initiated this purchase, can be nil

transactionId

the identifier of iap transaction, if this is given, we will check receipt validation. (Available in iOS 7.0 and later)

Return Value

n/a

Discussion

This method is called to track the purchase.

Declared In

Tapjoy.h

+ trackEvent:category:parameter1:parameter2:

This method is called to track an event of the given name with category, parameter1, parameter2 and values.

+ (void)trackEvent:(NSString *)name category:(NSString *)category parameter1:(NSString *)parameter1 parameter2:(NSString *)parameter2

Parameters

name

the name of event

category

the category of event, can be nil

parameter1

the parameter of event, string type, can be nil

parameter2

the parameter of event, string type, can be nil

value1

the value of value1name

value3name

the name of value3 of event

value2name

the name of value2 of event

value

the value of event

values

NSDictionary that contains values of event (key must be string & value must be number)

value3

the value of value3name

value1name

the name of value1 of event

value2

the value of value2name

Return Value

n/a

Discussion

This method is called to track an event of the given name with category, parameter1, parameter2 and values.

Declared In

Tapjoy.h

+ actionComplete:

Informs the Tapjoy server that the specified Pay-Per-Action was completed. Should be called whenever a user completes an in-game action.

+ (void)actionComplete:(NSString *)actionID

Parameters

actionID

The action ID of the completed action

Return Value

n/a

Discussion

Informs the Tapjoy server that the specified Pay-Per-Action was completed. Should be called whenever a user completes an in-game action.

Declared In

Tapjoy.h

+ sharedTapjoyConnect

Retrieves the globally accessible Tapjoy singleton object.

+ (id)sharedTapjoyConnect

Return Value

The globally accessible Tapjoy singleton object.

Discussion

Retrieves the globally accessible Tapjoy singleton object.

Declared In

Tapjoy.h

+ setUserID:

Assigns a user ID for this user/device. This is used to identify the user in your application

+ (void)setUserID:(NSString *)theUserID

Parameters

theUserID

The user ID you wish to assign to this device.

Return Value

n/a

Discussion

Assigns a user ID for this user/device. This is used to identify the user in your application

Declared In

Tapjoy.h

+ setUserIDWithCompletion:completion:

Assigns a user ID for this user/device. This is used to identify the user in your application

+ (void)setUserIDWithCompletion:(NSString *)theUserID completion:(networkCompletion)completion

Parameters

theUserID

The user ID you wish to assign to this device.

completion

The completion block that is invoked after a response is received from the server.

Return Value

n/a

Discussion

Assigns a user ID for this user/device. This is used to identify the user in your application

Declared In

Tapjoy.h

+ setCurrencyMultiplier:

Sets the currency multiplier for virtual currency to be earned. The default is 1.0.

+ (void)setCurrencyMultiplier:(float)mult

Parameters

mult

The currency multiplier.

Return Value

n/a

Discussion

Sets the currency multiplier for virtual currency to be earned. The default is 1.0.

Only used for non-managed (by Tapjoy) currency.

Declared In

Tapjoy.h

+ getCurrencyMultiplier

Gets the currency multiplier for virtual currency to be earned.

+ (float)getCurrencyMultiplier

Return Value

The currency multiplier value.

Discussion

Gets the currency multiplier for virtual currency to be earned.

Declared In

Tapjoy.h

+ enableLogging:

Toggle logging to the console.

+ (void)enableLogging:(BOOL)enable

Parameters

enable

YES to enable logging, NO otherwise.

Return Value

n/a

Discussion

Toggle logging to the console.

Declared In

Tapjoy.h

+ getVersion

Returns the SDK version.

+ (NSString *)getVersion

Return Value

The Tapjoy SDK version.

Discussion

Returns the SDK version.

Declared In

Tapjoy.h

TJCCurrencyManager Methods

+ getCurrencyBalance

Requests for virtual currency balance notify via TJC_GET_CURRENCY_RESPONSE_NOTIFICATION notification.

+ (void)getCurrencyBalance

Return Value

n/a

Discussion

Requests for virtual currency balance notify via TJC_GET_CURRENCY_RESPONSE_NOTIFICATION notification.

Declared In

Tapjoy.h

+ getCurrencyBalanceWithCompletion:

Requests for virtual currency balance information.

+ (void)getCurrencyBalanceWithCompletion:(currencyCompletion)completion

Parameters

completion

The completion block that is invoked after a response is received from the server.

Return Value

n/a

Discussion

Requests for virtual currency balance information.

Declared In

Tapjoy.h

+ spendCurrency:

Updates the virtual currency for the user with the given spent amount of currency.

+ (void)spendCurrency:(int)amount

Parameters

points

The amount of currency to subtract from the current total amount of currency the user has.

Return Value

n/a

Discussion

Updates the virtual currency for the user with the given spent amount of currency.

If the spent amount exceeds the current amount of currency the user has, nothing will happen.

Declared In

Tapjoy.h

+ spendCurrency:completion:

Updates the virtual currency for the user with the given spent amount of currency.

+ (void)spendCurrency:(int)amount completion:(currencyCompletion)completion

Parameters

amount

The amount of currency to subtract from the current total amount of currency the user has.

completion

The completion block that is invoked after a response is received from the server.

Return Value

n/a

Discussion

Updates the virtual currency for the user with the given spent amount of currency.

If the spent amount exceeds the current amount of currency the user has, nothing will happen.

Declared In

Tapjoy.h

+ awardCurrency:

Updates the virtual currency for the user with the given awarded amount of currency.

+ (void)awardCurrency:(int)amount

Parameters

amount

The amount of currency to add to the current total amount of currency the user has.

Return Value

n/a

Discussion

Updates the virtual currency for the user with the given awarded amount of currency.

Declared In

Tapjoy.h

+ awardCurrency:completion:

Updates the virtual currency for the user with the given awarded amount of currency.

+ (void)awardCurrency:(int)amount completion:(currencyCompletion)completion

Parameters

amount

The amount of currency to add to the current total amount of currency the user has.

completion

The completion block that is invoked after a response is received from the server.

Return Value

n/a

Discussion

Updates the virtual currency for the user with the given awarded amount of currency.

Declared In

Tapjoy.h

+ showDefaultEarnedCurrencyAlert

Shows a UIAlert that tells the user how much currency they just earned.

+ (void)showDefaultEarnedCurrencyAlert

Return Value

n/a

Discussion

Shows a UIAlert that tells the user how much currency they just earned.

Declared In

Tapjoy.h

TJCVideoManager Methods

+ setVideoAdDelegate:

Sets the class that implements the TJCVideoAdDelegate protocol.

+ (void)setVideoAdDelegate:(id<TJCVideoAdDelegate>)delegate

Parameters

delegate

The class that implements the TJCVideoAdDelegate protocol.

Return Value

n/a

Discussion

Sets the class that implements the TJCVideoAdDelegate protocol.

Declared In

Tapjoy.h