adding Interstitial into chartboost - ios

so after a week of attempting to load chart boost to my non-arc iOS app in Xcode, I'm gonna start asking some really silly questions.
my code in my appdelegate is:
(void)applicationDidBecomeActive:(UIApplication *)application {
[[CCDirector sharedDirector] resume];
Chartboost *cb = [Chartboost sharedChartboost];
cb.appId = #"530dd707f8975c182ae2c691";
cb.appSignature = #"0d8726e69c911a182b0cefac4eca36f692355725";
// Required for use of delegate methods. See "Advanced Topics" section below.
cb.delegate = self;
// Begin a user session. Must not be dependent on user actions or any prior network requests.
// Must be called every time your app becomes active.
[cb startSession];
[cb showMoreApps];
[cb cacheInterstitial:#"Play Again"];
[cb showInterstitial:#"Play Again"];
// Show an interstitial
[cb cacheInterstitial:#"Highscores"];
[cb showInterstitial:#"Highscores"];
when i start the app, yea i get the test ad appear so thats all good, but i cannot get it to show apps throughout the game or get these interstitials working at all.
so my first question: will the random ad's appear throughout the app(but only when the game is uploaded to the app store and not through test mode)
and secondly, can someone please explain with this showInterstitial locations. I've read many many documentations, even looked through the examples on chart boost, which they only link to buttons rather than to, for example, when i die in the game and then i want an ad to appear.
so can someone explain on here how to implement these interstitial appearance, as my "play again" and "highscores" seem to do nothing(and yes I've added a campaign logic but still, no ad is showing when the player dies and the screen goes to the high score page

few things:
Ads will appear throughout the app, not at random but where you place them.
The locations are simply names for your own reference. You still need to place the showInterstitial code in the right place for it to show when you want in. For instance, when your player dies and you should call [cb showInterstitial:#"play again"]; and when the player navigates to the high score page you call [cb showInterstitial:#"highscores"];.
The location names can be anything: location1, location2 or play again, highscores... it doesn't actually matter. But you should call [cb showInterstitial:#"play again"]; only on play again, and [cb showInterstitial:#"highscores"]; only when players view the high score screen. Once you set all that up in the app, you can turn interstitials on/off via the dashboard.
Finally, you should never call cacheInterstitial and showInterstitial immediately after each other. This can cause a race condition and produce unexpected results. Simply call cacheInterstitial when you bootup, and showInterstitial everywhere else in your app.
If you have any other questions, feel free to email support#chartboost.com
Full disclosure: I work at Chartboost

Related

iAd Interstitial: Determining if ad was shown?

I'm showing interstitials by using destinationVC.interstitialPresentationPolicy = ADInterstitialPresentationPolicy.Automatic before I actually show the destintion view controller.
How am I supposed to detect if an interstitial loaded? I need to know so I can know if I should reset a timer that let's me show interstitials every few minutes.
It's weird - even with 100% fill rate enabled in my developer settings, my interstitial doesn't always show...
I tried implementing ADInterstitialDelegate but it seems interstitialDidLoad doesn't actually execute?
For the fillrate, are you talking about test ads or live ads? iAd has a very low live ads fill rate and is even not supported at all in many countries...
For the delegate, did you assign the delegate e.g.
self.interstitial.delegate = self;
Assign it and do an NSLog for example in the delegate methods like in interstitialDidLoad to test if it s called...
P.S. A timer to fire ads isn t really a good idea... Ads should be fired after an action by a user, at a specific time regarding the app lifecycle / usage and should not interrupt, what would obviously happen if you use a timer...

Does clicking an iOS iAd pause new ads from being fetched?

When an iAd banner is clicked, and the interactive ad doesn't leave the app, are ads still received by the app while the full screen ad is displayed? Or is receiving new ads suspended at this time?
It doesn't say either way in Apple's docs.
I ask because I want to give the app every chance to optimize the CTR (click-through rate), so I'm wondering if I should stop ads manually like this:
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner
willLeaveApplication:(BOOL)willLeave {
if(!willLeave) {
[self destroyAdBanner]; // to stop receiving new ads
}
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self createAdBanner]; // start receiving new ads again if not already
}
What is the official approach? An Apple reference would be greatly appreciated.
There is no official documentation that I can find, but from repeated trials after an ad banner is clicked and the full-screen ad appears and waiting for long periods of time, there are no further calls to any of the ad delegate methods until the user interaction terminates. It looks like no new ads are fetched while in user interaction mode.

Adding an alert video for rewarded video ads

I have an iOS app with a button that (when tapped) plays rewarded video ads one after the other. The first times its tapped it plays ads from ad network 1, the second time its tapped it plays ads from ad network 2, and so on.
I want to add an alert that appears when the button is tapped asking the user if he/she are sure they want to play the video - if yes then the video plays, if no then the alert disappears.
Here is the code I currently have:
- (IBAction)freeTenCoins:(id)sender
{
// Try AppLovin.
if ([ALIncentivizedInterstitialAd isReadyForDisplay]) {
NSLog(#"Trying AppLovin");
[ALIncentivizedInterstitialAd show];
[Coins instance].coins += 10;
// Try LeadBolt.
} else {
NSLog(#"Trying LeadBolt");
[AppTracker loadModule:#"video" viewController:self];
}
Can anyone here show me how to show this alert? Any help would be much appreciated.
Actually, the AppLovin SDK has this feature built in.
All you need to do is go to the Manage Applications page, scroll down to the Rewarded Section and turn "Pre-video Modal" to on. We'll show an alert asking if they'd like to view the video, and then act on that. If they choose yes, we'll show an ad on your behalf; if they choose no, we'll notify you via the optional delegate method userDeclinedToViewAd: in ALAdRewardDelegate.
Of course you can also implement this feature yourself using UIAlertController or UIAlertView. This is actually what we do internally in the SDK anyway. This question elaborates more on that subject.

Calling interstitial iAd works only one time

I have spritekit game, Ad is preloaded on each start of game with [UIViewController prepareInterstitialAds]; And after gameover it should display ad with [self.view.window.rootViewController requestInterstitialAdPresentation]; and it's works okay, but only first time. The ad's shows only one time. After failing another game, ad do not show though preload. Any suggestions?
Do you have it set up to where it runs
[self.view.window.rootViewController requestInterstitialAdPresentation];
each time the game ends?
See the answer by gj15987 here...
requestInterstitialAdPresentation Works only one Time
He says there's a two minute block out period. I tried it and found it took 3min 20sec to allow another ad for me. I have fill rate set to 100% in the Developer section of Settings.
From the doc :
"The second major difference between a banner view and an full-screen advertisement is that the full-screen advertisement does not cycle through new content. An full-screen ad object loads a single advertisement; once that content expires, your app must release the ad object. Each time your app needs to show a new advertisement, it must explicitly create a new ad object."
straight from the horse's mouth :
iAd Programming Guide : Full-Screen Advertisements

How to avoid Game Center authentication repeating its block

Game Kit stores a strong reference to the completion handler that I send to authenticateWithCompletionHandler:, which means that each time the user exits and enters the app, it gets called again. This makes sense, but it causes a problem with a use case I have:
1) I prompt the user to log into Game Center when the app launches.
2) They tap Cancel because they want to play single player for a while. Therefore they are not logged in.
3) At some point, they decide they want to play online, so they tap my "Play Online" button.
4) This ought to show a screen where they can set up online game options, etc, but I notice they have no authenticated player, so…
5) I prompt the user again to log in to Game Center.
6) The user logs in this time, and in the completion handler I show my online game options screen.
Step 6 is the where the problem lies: every time the user leaves and re-enters the app, it will show my game options screen, because my completion handler is repeated. If I take out the code in the completion handler to show the online game options, the user has to tap the button twice - once to login, and once again to show the online options.
What is the smart solution to this?
For reference, a simplified version of my code looks like this:
- (IBAction)playOnlineTapped:(id)sender
{
GKLocalPlayer *localPlayer = [GKLocalPlayer localPlayer];
[localPlayer authenticateWithCompletionHandler:^(NSError *error) {
if (localPlayer.authenticated) {
[self showOnlineGameOptions];
}
}];
}
So many of the examples I have read assume that the user logs in first time, but I don't think that's always going to be the case.
Thanks in advance for your help!
One solution to this would be to not have the completion handler change your views. This seems like an odd idea because the completion handler is called asynchronously and could happen any time after you request authentication.
Instead, the completion handler could check if you are in the online menu and enable buttons for you. Until then, have these buttons disabled and show a message saying "waiting for Game Center". The key is not to trigger any scene transitions in your completion handler. That would be bad design because you don't know when this block is called.
Another hint. If the user declines to log in to Game Center, your authentication request at some point won't prompt the user. If I remember right, you will receive GKErrorUserDenied immediately. Therefore, you should tell users that they can launch your game from within the Game Center app.

Resources