Tanya Prashar
Tanya Prashar

Reputation: 27

Remove ad banner after completing in-app purchase within iPhone app

How is it possible to remove chartboost banner after in-App purchase ?

Upvotes: 0

Views: 1391

Answers (3)

Brian Hansen
Brian Hansen

Reputation: 206

Chartboost offers a delegate method -(BOOL) shouldDisplayInterstitial:(NSString*)location

Returning "false" in this method will prevent an ad from showing; remember to return "true" if you do want an ad to show. Just compare against a boolean stored locally to track if they bought the IAP or not.

The reason recommend this method rather than hardcoding is because you might want to leave a few locations specific for cross-promotion campaigns promoting your own apps that will still be able to show ads in the future.

This way when you release a new app you can run a limited promotion and make sure that your most loyal fans who bought the no-ads IAP can still see a cross-promo ad for your new game - a great way to funnel your highest quality users to your new app! If you make the ad art right, they won't even know it's an advertisement and you can make it so they only see it once.

Then you can add showInterstitial:@"cross-promo" wherever you might want to show this and disable all publishing campaigns just for that location. Then, in the future when you have a new app, add a new cross-promotion campaign in that location promoting your new app and EVERYONE will see it - even the people who bought IAP!

an example of this implementation:

-(BOOL) shouldDisplayInterstitial:(NSString*) location {
    if(_userBoughtNoAdsIAP && location != @"cross_promo"){
         return FALSE;
    }
    return TRUE;
}

And don't forget to set the [Chartboost sharedChartboost].delegate = self; to make sure the delegate methods function properly!

Full Disclosure: I work for Chartboost

Upvotes: 2

Ahsan.Amin
Ahsan.Amin

Reputation: 774

The easiest way is to save the information in user Defaults as mentioned in above post but this won't be secure because user defaults can easily be accessed by many softwares and one can edit/add your Key unless it is kind of big one and secret OR no body post it as a Hack.

The best thing is to store this information at Server (if you have it) or store this information in Key Chain because it is secured.

How to do that easily with keychain follow below post

iOS: How to store username/password within an app?

Upvotes: 2

Sumit Mundra
Sumit Mundra

Reputation: 3901

use something like this

set bool key isPurchase YES in your NSUserDefaults when you purchase App

if(![userDefaults boolForKey:@"isPurchase"])
        {
             NSLog(@"Enter add start ");

           [[Chartboost sharedChartboost]  showInterstitial];
        }
        [userDefaults synchronize];

    }

Upvotes: 3

Related Questions