iPhone ผมใส่โฆษณา Admob แบบ interstitial แล้วมันไม่โชว์ครับ แต่ถ้าใส่ ID ของ Google Example มัน Show ปกติเป็น Test Ads แต่ใส่ ID ผมมันไม่โชว์
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
พอ run ดูไม่มีโฆษณาขึ้น และ NSLog ขึ้น Error
iPhone จะโฆษณา Admob แบบ interstitial แล้วมันไม่โชว์
ViewController.h
@interface ViewController : UIViewController
@end
ViewController.m
#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
พอ run ดูไม่มีโฆษณาขึ้น และ NSLog ขึ้น Error