TJPlacement Class Reference

Inherits from NSObject
Declared in TJPlacement.h

Overview

The Tapjoy placement-Based Framework allows one to identify key placements within their application during development, and then reconfigure them on the dashboard as desired to help maximize monetization and engagement, without the need to update or resubmit the application.

Use the TJPlacement class to define placement points in your application where ads and other content can be served. placements could include launching the application, completing an achievement, finishing a level, or any other moment conducive to communicating with your users.

During your application development process, the key steps are to:

  1. Create and configure each placement as a TJPlacement

    TJPlacement *placement = [TJPlacement placementWithName: @"level_complete" delegate: self];
    
  2. Request content

    [placement requestContent];
    
  3. Present any content that is returned by the placement callbacks defined in TJPlacementDelegate

Other Methods

  delegate

The TJPlacementDelegate used to handle responses that are received upon sending this placement

@property (nullable, nonatomic, weak) id<TJPlacementDelegate> delegate

Discussion

The TJPlacementDelegate used to handle responses that are received upon sending this placement

Declared In

TJPlacement.h

  placementName

The name of the placement

@property (nonatomic, copy) NSString *placementName

Discussion

The name of the placement

Declared In

TJPlacement.h

  contentReady

Whether content has been loaded and is ready to be presented

@property (nonatomic, assign, readonly, getter=isContentReady) BOOL contentReady

Discussion

Whether content has been loaded and is ready to be presented

Declared In

TJPlacement.h

  contentAvailable

Whether content is available for this placement

@property (nonatomic, assign, readonly, getter=isContentAvailable) BOOL contentAvailable

Discussion

Whether content is available for this placement

Declared In

TJPlacement.h

  presentationViewController

The UIViewController to show the content in

@property (nullable, nonatomic, retain) UIViewController *presentationViewController

Discussion

The UIViewController to show the content in

Declared In

TJPlacement.h

  topViewControllerClassName

Allows plugins to specify a topViewController class (currently only used by Unity)

@property (nullable, nonatomic, copy) NSString *topViewControllerClassName

Discussion

Allows plugins to specify a topViewController class (currently only used by Unity)

Declared In

TJPlacement.h

  entryPoint

The point where Offerwall content is being presented.

@property (nonatomic, assign) TJEntryPoint entryPoint

Discussion

The point where Offerwall content is being presented.

Declared In

TJPlacement.h

+ placementWithName:delegate:

Creates a new instance of TJPlacement

+ (nullable instancetype)placementWithName:(NSString *)placementName delegate:(nullable id<TJPlacementDelegate>)delegate

Parameters

placementName

The name of the placement

delegate

The class that implements the TJPlacementDelegate protocol

Discussion

Creates a new instance of TJPlacement

Declared In

TJPlacement.h

– requestContent

Sends the placement request to the server

- (void)requestContent

Discussion

Sends the placement request to the server

Declared In

TJPlacement.h

– showContentWithViewController:

Shows the content that was received from the server after sending this placement

- (void)showContentWithViewController:(nullable UIViewController *)viewController

Discussion

Shows the content that was received from the server after sending this placement

Declared In

TJPlacement.h

+ dismissContent

Dismiss the content

+ (void)dismissContent

Discussion

Dismiss the content

Declared In

TJPlacement.h

Currency Methods

– setBalance:forCurrencyId:withCompletion:

Sets the currency balance. Only the balance of self-managed currencies can be set in this way.

- (void)setBalance:(NSInteger)balance forCurrencyId:(NSString *)currencyId withCompletion:(void ( ^ _Nullable ) ( NSError *_Nullable error ))completion

Parameters

balance

the amount of the currency. Must be greater than or equal to 0.

currencyId

the ID of the currency.

completion

block notifies that the currency balance has been set locally. Error parameter is nil if successful.

Discussion

Sets the currency balance. Only the balance of self-managed currencies can be set in this way.

Declared In

TJPlacement.h

– getBalanceForCurrencyId:

Gets the currency balance.

- (NSInteger)getBalanceForCurrencyId:(nullable NSString *)currencyId

Parameters

currencyId

the ID of the currency. If set to nil, will return the balance of Tapjoy-manaet currency.

Return Value

the amount of the currency balance, -1 if not available.

Discussion

Gets the currency balance.

Declared In

TJPlacement.h

– setRequiredAmount:forCurrencyId:withCompletion:

Sets the currency amount required

- (void)setRequiredAmount:(NSInteger)requiredAmount forCurrencyId:(NSString *)currencyId withCompletion:(void ( ^ _Nullable ) ( NSError *_Nullable error ))completion

Parameters

requiredAmount

The amount of currency the user needs. Must be greater than 0.

currencyId

the ID of the currency.

completion

block notifies that required amount of currency has been set locally. Error parameter is nil if successful.

Discussion

Sets the currency amount required

Declared In

TJPlacement.h

– getRequiredAmountForCurrencyId:

Gets the currency amount required.

- (NSInteger)getRequiredAmountForCurrencyId:(NSString *)currencyId

Parameters

currencyId

the ID of the currency.

Return Value

The amount of currency the user needs. -1 if not available.

Discussion

Gets the currency amount required.

Declared In

TJPlacement.h