Ios admob间隙自动闭合
我正在使用admob的双击dfp广告。 我想在几秒钟后关闭/关闭Interstitual。 如果用户没有点击广告 我可以在延迟后解除ModalViewController,但即使用户点击广告,它也会关闭广告Ios admob间隙自动闭合,ios,admob,google-dfp,Ios,Admob,Google Dfp,我正在使用admob的双击dfp广告。 我想在几秒钟后关闭/关闭Interstitual。 如果用户没有点击广告 我可以在延迟后解除ModalViewController,但即使用户点击广告,它也会关闭广告 有什么建议吗?经过多次尝试,结果是: 显然,用填隙材料是不可能做到这一点的 创建初始屏幕的最佳方法是使用普通adview,并将其调整为屏幕大小。您必须实现委托并实现委托的方法interstitutialwilldismisssscreen:gadistitutial*ad 这意味着必须自动关
有什么建议吗?经过多次尝试,结果是: 显然,用填隙材料是不可能做到这一点的 创建初始屏幕的最佳方法是使用普通adview,并将其调整为屏幕大小。您必须实现委托并实现委托的方法interstitutialwilldismisssscreen:gadistitutial*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");
}