вы должны реализовать <GADInterstitialDelegate>
делегата и реализовать метод делегата interstitialWillDismissScreen:(GADInterstitial *)ad
#import "MainViewController.h"
#import "GADInterstitial.h"
@interface MainViewController()<GADInterstitialDelegate>
@property(nonatomic, strong) GADInterstitial *interstitial;
@end
@implementation MainViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.interstitial = [[GADInterstitial alloc] init];
self.interstitial.adUnitID = @"ca-app-pub-3940256099942544/4411468910";
GADRequest *request = [GADRequest request];
// Requests test ads on simulators.
request.testDevices = @[ GAD_SIMULATOR_ID ];
[self.interstitial loadRequest:request];
}
-(void)interstitialDidReceiveAd:(GADInterstitial *)ad
{
NSLog(@"interstitialDidReceiveAd successfully");
[ad presentFromRootViewController:self];
}
-(void)interstitialWillDismissScreen:(GADInterstitial *)ad{
NSLog(@"interstitial is going to dismiss");
}
это должно автоматически закрывать межстраничный.
На самом деле это неправильный способ реализации этой функции. Вы можете видеть выше вас, ответы Дэниела с лучшим решением. –