Ошибка запроса баннера Admob: нет объявления для показаIOS

Программируем под IOS
Ответить
Anonymous
 Ошибка запроса баннера Admob: нет объявления для показа

Сообщение Anonymous »

У меня возникла эта проблема с одной из моих реклам для игры для iOS

Вот мой код, странно то, что если я добавлю устройство в список request.testDevices, он отобразит демонстрационный баннер, если я удалю из testDevices, он не покажет настоящий баннер, но если я изменю свой идентификатор пакета в XCODE, он покажет настоящий баннер, поэтому я считаю, что это что-то с моей учетной записью admob, кто-нибудь когда-нибудь получал что-то вроде это?

Он всегда терпит неудачу с этой ошибкой:

AdView DidFailToReceiveAdWithError --------------------------- : Error Domain=com.google.ads Code=1 «Ошибка запроса: нет объявления для показа». UserInfo={NSLocalizedDescription=Ошибка запроса: нет объявления для показа., NSLocalizedFailureReason=Ошибка запроса: нет объявления для показа.

На моем AppDelegate.m

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

// Use Firebase library to configure APIs
[FIRApp configure];
[[FIRAnalyticsConfiguration sharedInstance] setAnalyticsCollectionEnabled:YES];
// Initialize Google Mobile Ads SDK
[GADMobileAds configureWithApplicationID:@"ca-app-pub-xx~xx"];
/* other stuff here... */

}


на моем rootViewController.m

// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
bannerViewAdded = NO;
interstitialViewAdded = NO;

[self addBanner];
// ..... more stuff here;
}

- (void)addBanner{

NSLog(@"CALL ADD BANNER ROOTVIEWCONTROLLER");

if(!bannerViewAdded && ![MKStoreManager isFeaturePurchased:kFeatureAId]){

NSLog(@"ADD BANNER ROOTVIEWCONTROLLER");
CGSize size = [[CCDirector sharedDirector] winSize];

// Create adMob ad View (note the use of various macros to detect device)
if (IS_IPAD || IS_IPADHD) {
bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeLeaderboard];
bannerView.center = CGPointMake(size.width/2, (size.height-CGRectGetHeight(bannerView.frame)/2)-2);
}
else if (IS_IPHONE6) {
bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
bannerView.center = CGPointMake(size.width/2, (size.height-CGRectGetHeight(bannerView.frame)/2)-2);
}
else if (IS_IPHONE6P) {
bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
bannerView.center = CGPointMake(size.width/2, (size.height-CGRectGetHeight(bannerView.frame)/2)-2);
}
else {
// boring old iPhones and iPod touches
bannerView = [[GADBannerView alloc] initWithAdSize:kGADAdSizeBanner];
bannerView.center = CGPointMake(size.width/2, (size.height-CGRectGetHeight(bannerView.frame)/2)-2);
}

//[bannerView setBackgroundColor:[UIColor blueColor]];

// Need to set this to no since we're creating this custom view.
//bannerView.translatesAutoresizingMaskIntoConstraints = NO;

// Note: Edit SampleConstants.h to provide a definition for kSampleAdUnitID
// before compiling.

// Replace this ad unit ID with your own ad unit ID.
bannerView.adUnitID = @"ca-app-pub-xx/xx";
bannerView.rootViewController = self;
bannerView.delegate = self;
[self.view addSubview:bannerView];

GADRequest *request = [GADRequest request];
//request.testDevices = @[ kGADSimulatorID ];
//request.testDevices = @[ @"xx", @"xx" , kGADSimulatorID ];

[bannerView loadRequest:request];
bannerViewAdded = YES;
}

}

- (void)removeBanner {
//admob
if(bannerViewAdded){
bannerViewAdded = NO;
[bannerView removeFromSuperview];
[bannerView release];
bannerView = nil;
}
//No AdMOB
if(localBannerAdded){
localBannerAdded = NO;
[localBannerButton removeFromSuperview];
[localBannerButton release];
localBannerButton = nil;
}
}

- (void)addInterstitial{

if(!interstitialViewAdded && ![MKStoreManager isFeaturePurchased:kFeatureAId]){
NSLog(@"INIT INTERSTITIAL ROOTVIEWCONTROLLER");
interstitialView = [[GADInterstitial alloc] initWithAdUnitID:@"ca-app-pub-xx/xx"];

GADRequest *request = [GADRequest request];
// Requests test ads on devices you specify. Your test device ID is printed to the console when
// an ad request is made. GADBannerView automatically returns test ads when running on a
// simulator.
//request.testDevices = @[ kGADSimulatorID, @"xxx", @"xxx" ];
[interstitialView loadRequest:request];
[interstitialView setDelegate:self];

}

}

- (void)adView:(GADBannerView *)gadBannerView didFailToReceiveAdWithError:(GADRequestError *)error{
NSLog(@"AdView didFailToReceiveAdWithError --------------------------- : %@", error);
[self removeBanner];
if(!localBannerAdded){
CGSize size = [[CCDirector sharedDirector] winSize];
localBannerButton = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
localBannerButton.frame = CGRectMake(0.0, 0.0, 320.0, 50.0);
[localBannerButton setTitle:@"DOWNLOAD MORE FREE GAMES" forState:UIControlStateNormal];
localBannerButton.backgroundColor = [UIColor whiteColor];//[UIColor clearColor];
[localBannerButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal ];
[self.view addSubview:localBannerButton];

[localBannerButton setCenter:CGPointMake(self.view.center.x,(size.height-CGRectGetHeight(localBannerButton.frame)/2)-2)];

// Add Target-Action Pair
[localBannerButton addTarget:self action:@selector(openAppStore:) forControlEvents:UIControlEventTouchUpInside];
localBannerAdded = YES;
}
}


Подробнее здесь: https://stackoverflow.com/questions/391 ... ad-to-show
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»