Alex
Alex

Reputation: 93

AdMob only sends real ads, not test ads, why?

-(void)resetAdView:(UIViewController *)rootViewController {

 currentDelegate_ = rootViewController;


if (ADloads) {
    [rootViewController.view addSubview:adBanner_];

    adBanner_.delegate = self;                                        
    adBanner_.rootViewController = rootViewController;                
    adBanner_.adUnitID = @"Unit-ID";  
    GADRequest *request = [GADRequest request];                      
    [adBanner_ loadRequest:request];                                  
    ADloads = YES;                                                  

    request.testDevices= @[ GAD_SIMULATOR_ID ]; 


} else {


    adBanner_.delegate = self;                                        
    adBanner_.rootViewController = rootViewController;                
    adBanner_.adUnitID = @"Unit-ID";   

    GADRequest *request = [GADRequest request];                       
    [adBanner_ loadRequest:request];                                  
    [rootViewController.view addSubview:adBanner_];                   
    ADloads = YES;                                                  
  request.testDevices= @[ GAD_SIMULATOR_ID ];  


}

}

Can't understand why AdMob only sends real ads and not the test ads like i'm requesting. What's wrong with the code that it only sends real ads?

Upvotes: 0

Views: 368

Answers (1)

RedBrogdon
RedBrogdon

Reputation: 5351

[adBanner_ loadRequest:request]; // send request                                  
[rootViewController.view addSubview:adBanner_];                   
ADloads = YES;                                                  
request.testDevices= @[ GAD_SIMULATOR_ID ] // modify request to add test device

The line in which you're adding the simulator as a test device is after the one in which you send the request. The request is already on its way to the server by that point. It's too late.

Try reordering your statements and see what happens.

Upvotes: 1

Related Questions