2013-09-24 27 views
1

我在iphone應用程序中插入了adBannerView。我遵循文檔中描述的蘋果示例。當應用程序在調試模式下運行時,廣告顯示正確(測試版本),但在發佈版本中,當真實用戶使用應用程序時,我看到一個白色框,它應該顯示橫幅。iOS - 在最終版本上未顯示ADBannerView

也許我錯過了/忘記了或者我做錯了什麼?

視圖控制器,顯示旗幟有一個initBanner方法:

- (void) initBanner{ 

    ADBannerView *_bannerView = nil; 

    if (!is2ShowBanner){ 
     _bannerView = nil; 
     MyLogEvidence(@"%@ BANNER da Nascondere", [self.class description]); 
     return; 
    } 

    MyLogEvidence(@"%@ BANNER da Visualizzare", [self.class description]); 


    _bannerView = [[ADBannerView alloc] initWithAdType:ADAdTypeBanner]; 
    [_bannerView setDelegate:self]; 

    CGRect bounds = self.view.bounds ; 
    CGRect frame = _bannerView.frame; 
    frame.origin = CGPointMake(CGRectGetMinX(bounds),CGRectGetMaxY(bounds)- _bannerView.frame.size.height); 

    [_bannerView setFrame:frame]; 

    [self.view addSubview:_bannerView]; 
} 

-(void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error{ 

    [self layoutForBanner:banner animated:YES ]; 
} 


-(void)bannerViewDidLoadAd:(ADBannerView *)banner{ 

    [self layoutForBanner:banner animated:YES]; 
} 

- (void)layoutForBanner:(ADBannerView*)_bannerView animated:(BOOL)animated 

{ 

    if (_bannerView == nil){ 

     MyLog(@"BANNER non presente"); 

     [_constraintVerticalForBanner setConstant:3.0]; 
     [self.view layoutIfNeeded]; 
     [self.view updateConstraintsIfNeeded]; 

     return; 
    } 


    [_bannerView setHidden:!_bannerView.bannerLoaded]; 

    [_constraintVerticalForBanner setConstant:_bannerView.hidden? 3.0 : _bannerView.frame.size.height+3]; 

     [self.view layoutIfNeeded]; 

     [self.view updateConstraintsIfNeeded]; 

     MyLog(@"%@.constraintVerticalForBanner start: %3.0f",[self.class description],_constraintVerticalForBanner.constant); 

} 

-(BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner willLeaveApplication:(BOOL)willLeave{ 

    return YES; 

} 

呼叫開始從:

-(void)viewDidAppear:(BOOL)animated{ 

    [super viewDidAppear:animated]; 

    [self initBanner]; 

} 
+2

您是否在iTunes連接中啓用了廣告? – giorashc

回答

0

那麼,如果測試,但不是真正的用戶,那麼你可能做的時候它的工作原理在您的iTunes中不啓用應用程序管理下的iad的常見和痛苦錯誤連接。

請看here瞭解如何啓用廣告,如果您還沒有做到。

爲什麼它很痛苦?因爲您必須將應用程序狀態更改爲等待上傳,並且您的應用程序需要等待另一次審覈。 (在你上傳了一個新的二進制文件之後)

另一個原因可能是iad的展示率並非如此,而且你的應用中的每個廣告請求都不會回覆一個印象,因此請嘗試等待幾分鐘被顯示。

+0

謝謝giorashc, 該死! :)我認爲我在這個版本處於「準備銷售」狀態後才啓用它。 我必須等待下一個版本獲得批准。 – tylyo

+0

是的,令人沮喪但這就是它的工作原理,雖然更新應該比新的二進制文件更快審查 – giorashc

+0

giorashc你有權利!現在橫幅是可見的...如果你想看看應用程序:):[簡單收據](https://itunes.apple.com/us/app/easy-receipts/id693054121) – tylyo

相關問題