To get test ads on this device, call: request.testDevices = [NSArray arrayWithObjects:GAD_SIMULATOR_ID, nil];
You have to add your test devices. With Swift, just replace
bannerView.load(GADRequest())
with
let request: GADRequest = GADRequest()
request.testDevices = [kGADSimulatorID]
bannerView.load(request)
If you have an iPhone, then run the application too and it will tell you the ID.
To get test ads on this device, call: request.testDevices = @[@"HERE IS THE ID"];
ID added:
let request: GADRequest = GADRequest()
request.testDevices = ["PUT HERE THE ID", kGADSimulatorID]
bannerView.load(request)
At finally fix the bug friends..
I made mistake to generate adUnitID. So only i cannot get ad view.
Now get one adUnitID from xxxx site for testing. And its working fine..
adUnitID = @"a14dccd0fb24d45";
Thanks for All Supporters.
Since the newest update the request.testDevices
has been replaced with:
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers
I have gotten it to work with this:
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [(kGADSimulatorID as! String)]
[EDIT]
In my app delegate I am using this code:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
// use this for production
GADMobileAds.sharedInstance().start(completionHandler: nil)
// use this for testing
GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = [ kGADSimulatorID ]
return true
}
This is for Swift 5, iOS 13 and Google-Mobile-Ads-SDK (7.58.0)