Hello again, apple community! So Ive recently been trying to implement interstitial iads into my game. Ive had very little look however i manged to get it working yesterday. The project I was using to test the ads was in portrait and this was working fine. However, when I swapped the app to run in horizontal/landscape mode the "didFailWithError" method was called indicating that the ad had failed (also the NSLog printed the following in to the console - "FAILED"). The following code is what I am working with (This code is in my GameScene Class) :
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
if (adShowing == false) {
[self loadInterstitialAd];
}
}
-(void)update:(CFTimeInterval)currentTime {
/ Called before each frame is rendered */
/
if (adShowing == true) {
NSLog(@"TRUE");
} else {
NSLog(@"FALSE");
}
*/
}
-(void) loadInterstitialAd {
/
[self.delegate showInterstitialAd];
_interstitialAd = [[ADInterstitialAd alloc] init];
_interstitialAd.delegate = self;
adShowing = true;
}
-(void) interstitialAdWillLoad:(ADInterstitialAd *)interstitialAd {
}
-(void) interstitialAdDidLoad:(ADInterstitialAd *)interstitialAd {
interstitialAdView = [[UIView alloc] init];
interstitialAdView.frame = (self.view.bounds);
[self.view addSubview:interstitialAdView];
[_interstitialAd presentInView:interstitialAdView];
[UIViewController prepareInterstitialAds];
}
-(void) interstitialAdActionDidFinish:(ADInterstitialAd *)interstitialAd {
[interstitialAdView removeFromSuperview];
adShowing = false;
}
-(void) interstitialAd:(ADInterstitialAd *)interstitialAd didFailWithError:(NSError *)error {
NSLog(@"FAILED");
/
}
-(void) interstitialAdDidUnload:(ADInterstitialAd *)interstitialAd{
/
}
Thanks in advance! 🙂
Kind Regards
Ryan