1
iOS不顯示管理插頁式廣告ID ca-app-pub-3940256099942544/4411468910(Google示例)顯示測試admob插頁式廣告但ID我ca-app-pub-8084139945896039/3483224303不顯示???iOS不顯示admob插頁式廣告
ViewController.h
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController
@end
ViewController.m
#import "ViewController.h"
#import "GADInterstitial.h"
@interface ViewController()<GADInterstitialDelegate>
@property(nonatomic, strong) GADInterstitial *interstitial;
@property(nonatomic, strong) UIImageView *imageView;
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.interstitial = [[GADInterstitial alloc] init];
self.interstitial.adUnitID = @"ca-app-pub-8084139945896039/3483224303";
self.interstitial.delegate = self;
[self.interstitial loadRequest:[GADRequest request]];
// Assumes an image named "SplashImage" exists.
self.imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"SplashImage"]];
self.imageView.frame = self.view.frame;
self.imageView.contentMode = UIViewContentModeScaleAspectFill;
[self.view addSubview:self.imageView];
}
- (void)interstitialDidReceiveAd:(GADInterstitial *)interstitial {
[self.interstitial presentFromRootViewController:self];
NSLog(@"Method 3");
}
- (void)interstitial:(GADInterstitial *)interstitial
didFailToReceiveAdWithError:(GADRequestError *)error {
[self.imageView removeFromSuperview];
NSLog(@"Error");
}
- (void)interstitialWillDismissScreen:(GADInterstitial *)interstitial {
[self.imageView removeFromSuperview];
NSLog(@"Method 3");
}
@end