2014-03-26 114 views
0

在我的cocos2d-x項目中,我已經完成了以下代碼,用於在設備/模擬器上展示廣告。在模擬器或設備上不顯示Ad-mob廣告

GADInterstitial *gAdInterstitial; = [[GADInterstitial alloc] init]; 
    gAdInterstitial.adUnitID = @gAdUnitID; 
    NSLog(@"Add Unit Id %@",gAdInterstitial.adUnitID); 
    //AdMob 
    GADRequest *request = [GADRequest request]; 
//  request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, nil]; 
// request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID,@"122189cf8ed3c83551f5df0585f4694f410f5041", @"eb26e6181da2a2da39f3410cd29c4c2c26ac19a6", nil]; 
    request.testing = YES; 
    request.testDevices = @[GAD_SIMULATOR_ID]; 
    [gAdInterstitial loadRequest:request]; 
    gAdInterstitial.delegate = self; 

此代碼已在rootviewcontroller類和iOS的appcontroller類中完成。問題在於即使在網絡上也沒有顯示任何廣告。

+0

嘗試在loadRequest之前設置'gAdInterstitial'的委託: – tipycalFlow

回答

0

檢查你的單元ID,也在 request.testDevices = @ [GAD_SIMULATOR_ID]; 指定您的模擬器ID或設備ID。

將測試設置爲YES進行測試並不重要,您可以使用生產設置運行,但避免點擊廣告。