插页式广告在第四次点击后只显示一次。有人可以这样做,例如我想要的每次点击(第10次点击,第20次点击......)
if ([self.interstitial isReady]) {
if (count > 4){
[self.interstitial presentFromRootViewController:self];
count = 0;
}
}
count += 1;
答案 0 :(得分:0)
if ([self.interstitial isReady]) {
[self.interstitial presentFromRootViewController:self];
}
- (GADInterstitial *)createAndLoadInterstitial
{
GADInterstitial *interstitial = [[GADInterstitial alloc] init];
interstitial.adUnitID = @"ca-app-pub-yourAdId";
interstitial.delegate = self;
[interstitial loadRequest:[GADRequest request]];
return interstitial;
}
请在启动应用程序时使用此方法,然后您可以在任何地方设置follow方法:
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
if ([appDelegate.interstitial isReady]) {
[appDelegate.interstitial presentFromRootViewController:self];
}