2016-08-23 153 views
7

我有我的一個廣告這個問題對於IOS遊戲AdMob聯播bannerView請求錯誤:沒有廣告顯示

這裏是我的代碼,奇怪的是,如果我添加了設備上的要求。 testDevices列表顯示演示橫幅,如果我從testDevices中移除,它不會顯示真正的橫幅,但是如果我在XCODE上更改我的bundleIdentifier,它會顯示一個真正的橫幅,所以我相信它與我的admob帳戶有關,是否有人有類似的東西?

它總是得到這個錯誤:

的AdView didFailToReceiveAdWithError ---------------------------:錯誤域=融爲一體。 google.ads代碼= 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; 
    } 
} 
+0

我的旗幟已經從遊戲試玩區1米像素的距離,因此刪除的旗幟玩遊戲畫面,並要求新的評估,爲我確定。令人遺憾的是,花了將近3個月的時間才從Admob那裏得到問題的答案,我從來沒有收到過一封電子郵件,或者是來自admob的任何其他聯繫人。在蘋果批准我的遊戲的新版本之後,修復速度很快,在12小時內我的旗幟又回來了。 –

回答

9

廣告服務器將返回此郵件,主要是因爲您的廣告單元ID沒有廣告。檢查您的廣告單元ID是否正確。如果橫幅寬度/高度爲0,則會出現相同的錯誤。確保您的adUnitID是完美的。 或 檢查以下鏈接它可以幫助你 https://groups.google.com/forum/#!topic/google-admob-ads-sdk/ioXU2nX9W28

AdMob Legacy Publisher ID not showing ads

+0

我不相信自己被列入黑名單,我查看了我的AdSense帳戶,並且我沒有看到任何關於該狀態的信息。 我發了一條消息,以便他們可以檢查它的黑名單,但沒有迴應。 我嘗試了兩種方法,沒有幸運,我想我必須等待,以便admob中的某個人看起來在我的帳戶中,如果我更改包標識符,並確信它不是adUnitID因爲它也顯示不同的捆綁。 –

+3

設置橫幅寬度/高度爲我固定。巨大的幫助! – mrgrieves

+0

我的旗幟與遊戲區域有1像素距離,因此從遊戲播放屏幕中移除橫幅,並要求重新評估,這對我來說是固定的。令人遺憾的是,花了將近3個月的時間才從Admob那裏得到問題的答案,我從來沒有收到過一封電子郵件,或者是來自admob的任何其他聯繫人。在蘋果批准我的遊戲的新版本之後,修復速度很快,在12小時內我的旗幟又回來了。 –

2

我也遇到了這個錯誤。我的橫幅廣告和插頁式廣告都因此錯誤而失敗。我發現,在將UserAgent更改爲默認設置後,全局更改UserAgent是我的錯誤。

+0

如何更改UserAgent? – amar

17

當限制廣告跟蹤(在設置/隱私/廣告)開啓時,在iOS 10上體驗此操作。

+2

這篇文章需要注意。我有一個啓用此功能的iPhone。我們遇到任何橫幅的問題。 – Makalele

+0

這讓我發瘋,爲什麼它在模擬器中運行,而不是在我的設備上運行,我甚至沒有意識到我意外地將它打開了! –

+1

在「設置/隱私/廣告」中重置「廣告標識符」適用於「iPhone 7+ iOS 11.2」,並且現在在模擬器上顯示測試廣告但不顯示真實設備後再次顯示橫幅廣告。 – Reanimation

11

我今天剛剛出現這個錯誤,對我來說問題很簡單,這是因爲adUnitID基本上還是新的。創建adUnitID後,爲了投放廣告,我不得不等待2個多小時。

如果你有這個錯誤,你的一些adUnitIDs服務廣告和一些不。你很可能有同樣的問題,解決問題的唯一方法就是等待。

4

我剛剛創建了一個新帳戶並看到了這個問題。在檢查我的帳戶時,admob頁面頂部顯示一條消息:「您的廣告單元沒有展示廣告,因爲您尚未提供帳戶付款信息。」點擊按鈕對其進行修復,填寫表格和廣告將在數小時內顯示

2

這解決了我的問題

  1. 改變旗幟ID示例ID。
  2. 然後運行應用程序。
  3. 將id更改回生產ID。
0

對我來說,它開始顯示的原因是我沒有在我的AdMob帳戶上設置任何付款方式。

一旦我設置好了,錯誤消失了,廣告開始立即顯示。

希望這可以幫助別人!

0

如果您使用的是調試或測試模式下您的應用程序請確保您使用測試的AppID和BannerID由谷歌的AdMob提供這將是如下: -

谷歌測試AdMobID: 爲ca-app-PUB-3940256099942544 〜1458002511

谷歌測試BannerID 爲ca-app-PUB-2934735716分之3940256099942544

0

如果您在AdMob帳戶無法爲您設置的支付和結算信息可能會發生此錯誤。 作爲爲每個AdMob後,您設置的付款細節,可能需要長達2個小時這將是功能完整的前

Billing and Payments