Search code examples
swiftadmob

Identify the test device for Admob


I use the code below:

let request : GADRequest = GADRequest ()

request.testDevices = ["xxxxxxx",kGADSimulatorID]

But I am getting the below warning:

'testDevices' is deprecated: Use GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers.

Do I use a syntax to remove the warning?


Solution

  • You should use this:

    GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = ["YOUR IDENTIFIER PRINTED ON DEBUGGER"]
    

    Instead of:

    request.testDevices = ["YOUR IDENTIFIER PRINTED ON DEBUGGER"]