我正在使用admob的DoubleClick(dfp)廣告。 我想關閉/關閉幾秒鐘後的插頁式。 (就像用戶沒有點擊廣告一樣)。admob插頁式自動關閉
afterDelay後我可以做dismissModalViewControllerAnimated
,但即使用戶點擊它們也會關閉廣告。
有什麼建議嗎?
我正在使用admob的DoubleClick(dfp)廣告。 我想關閉/關閉幾秒鐘後的插頁式。 (就像用戶沒有點擊廣告一樣)。admob插頁式自動關閉
afterDelay後我可以做dismissModalViewControllerAnimated
,但即使用戶點擊它們也會關閉廣告。
有什麼建議嗎?
經過多次嘗試,結果如下: 顯然,使用插頁式廣告不可能做到這一點 製作啓動畫面的最佳方式是正常瀏覽,並將其調整爲屏幕大小。
你必須實現<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");
}
這是必須自動關閉您的插頁。
實際上這是實現此功能的錯誤方法。你可以在上面看到,丹尼爾的答案是最好的解決方案。 –