Objective-C

Using the SDK

Once integrated the SDK, you are ready to start using it!
Tappx App Key: First of all, you need to create a Tappx account on our website (http://www.tappx.com) and create an APP in the "My Apps" section. Once created, you will receive an App KEY that you will need in order to request ads. There is one App KEY for each app and operating system, so if you have apps with more than one operating system, you will need to create one app for each.

Tappx initialization

In the AppDelegate file of the Project add the lines in yellow from the following example:

#import "AppDelegate.h"
#import <TappxFramework/TappxAds.h>

@interface AppDelegate ()
@end

@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    [TappxFramework addTappxKey:@"**YOUR-APP-KEY**"];
    return YES;
}
@end

Interstitials

Interstitial is an ad shown in fullscreen, with the option to close it.
Add to the ViewController.h file the following lines:

#import <TappxFramework/TappxAds.h>

@interface ViewController : UIViewController <TappxInterstitialViewControllerDelegate>

@property (retain, nonatomic) TappxInterstitialViewController* tappxInterstitial;

@end

Now you need to initialize the Interstitial in the ViewController.m file.
Example:

#import "ViewController.h"
#import <TappxFramework/TappxAds.h>

@interface ViewController ()
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   _tappxInterstitial = [[TappxInterstitialViewController alloc] initWithDelegate:self];
   [_tappxInterstitial setAutoShowWhenReady:YES];
   [_tappxInterstitial load];
}

-(UIViewController*)presentViewController{
    return self;
}
@end

If you want to request an interstitial to be shown as soon as it be ready, can use this method:

[_tappxInterstitial setAutoShowWhenReady:YES];

If you want to have more control, you can use the following three options: load, isReady and show.

load is the request to get the ad and load all the information so you can show the ad.

[_tappxInterstitial load];

isReady allows you to check if the ad is ready to be shown. You will receive a "true" if the ad is ready and a "false" if not.

[_tappxInterstitial isReady];

show allows you to display the interstitial ad that has loaded previously.

[_tappxInterstitial show];

These three options are useful in games for example, if you want to load the ad while the user is playing and show it immediately when the user finishes the play.

Delegates

You can add listener events into the Interstitial to be notified when a specific event happens in the ad. Here you have examples:

-(void) tappxInterstitialViewControllerDidFinishLoad:(TappxInterstitialViewController*) viewController{
    NSLog(@"INTERSTITIAL: FinishLoad");
}
-(void) tappxInterstitialViewControllerDidFail:(TappxInterstitialViewController) viewController
withError:(TappxErrorAd) error{
    NSLog(@"INTERSTITIAL: DidFail %@", error.descriptionError);
}
-(void) tappxInterstitialViewControllerDidPress:(TappxInterstitialViewController*) viewController{
    NSLog(@"INTERSTITIAL: DidPress");
}
-(void) tappxInterstitialViewControllerDidClose:(TappxInterstitialViewController*) viewController{
    NSLog(@"INTERSTITIAL: DidClose");
}
-(void) tappxInterstitialViewControllerDidAppear:(TappxInterstitialViewController*) viewController{
    NSLog(@"INTERSTITIAL: DidAppear");
}

Additional information in the requests (interstitials and banners)

When you send a request (for banner or interstitial), we recommend to send additional information to get better results (earnings or downloads). It’s as easy as adding a parameter of the AdRequest type when you use the load method.
It’s not necessary to add all the information, but the more information you send, the better results you will get.

Example:

//For interstitials
TappxSettings *settings = [TappxSettings new];
[setting setAge:25];
[setting setGender:TappxGenderMale];
[setting setMarital:TappxMaritalSingle];
[setting setYearOfBirth:1986];

[_tappxInterstitial load:setting];

//For banners
TappxSettings *settings = [TappxSettings new];
[setting setAge:40];
[setting setGender:TappxGenderFemale];
[setting setMarital:TappxMaritalMarried];
[setting setYearOfBirth:1986];

[_tappxBanner load:setting];

Tappx © 2020