Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Admob iOS: Getting com.google.DummyAdapter on real device, works on simulator

Tags:

ios

admob

I am having this issue with Admob:

Cannot find an ad network adapter with the name(s): ("com.google.DummyAdapter"). Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target.

I have read that this could be due to a "no-fill" problem when asking for a network adapter, but this is happening to me only if I try on a real device. If I try it on the simulator, I receive the ads correctly.

Any ideas?

like image 853
estemendoza Avatar asked Feb 05 '16 10:02

estemendoza


2 Answers

THIS MAY BE HELPFUL FOR SOMEONE!!!

I got the same error when I used the Ad Unit Ids defined in the AdMob app for testing on my iPhone. Of course the device has to be registered as a Test Device. I was adding the Test Device Id programmatically.

This is where I went a wrong route. The documents has clearly mentioned steps on how to register a device as a Test Device. Instead all that I somehow made my mind to register the device's UDID as the Test Device Id(This is the mistake I made. Now I accept that it is purely my ignorance). After searching through most of the solutions provided in SO, and some of the other blogs, I just wanted to try the AdMob UI to add a test device. There I saw Advertising ID/IDFA which had a link on how to find the advertising ID/IDFA.

AdMob -> Settings -> Test Devices -> Add Test Device

Just to reiterate the steps which fixed the issue for me:

  1. Take/copy the Ad Unit Ids which you defined in your AdMob app

  2. Put those Ad Unit Ids in your code.(I used xcconfig files to separate Dev vs Prod)

  3. Run the app by now you might have setup all your ad plugging code

  4. Check the Xcode console(important), there you will see the Test Device Id suggested by Google. Which will look something like below:

    <Google> To get test ads on this device, set: GADMobileAds.sharedInstance.requestConfiguration.testDeviceIdentifiers = @[ @"2077ef9a63d2b398840261c8221a0c9b" ]; // Pay attention at this bolded id, this is the one which we want.

  5. The above code is in Obj-C. Use the below code in Swift 5+

    GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = ["2077ef9a63d2b398840261c8221a0c9b"]


Take away: Test Device Identifier is not UDID of the device but the Advertising Identifier. Check this: https://support.google.com/admob/answer/9691433?hl=en#ID


Tip: I used the Dev.xcconfig file to add the Test Device identifiers, so that the Prod.xcconfig is clean without those test device ids and the app can be submitted without any code changes.

 /// Extract those test device ids from the xcconfig file.
 if let testIDs = self.extractTestDeviceIDs() {
    debugPrint("FOUND: test IDs: ", testIDs)
    GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = testIDs
 } else {
    debugPrint("NOT FOUND: test IDs")
    /// NoOp: This has to be prod environment
    /// If the test IDs are not configured, then also Ads should be initialized.
 }

 GADMobileAds.sharedInstance().start { initStatus in
    debugPrint("GAD Ads... Init Status: ", initStatus)
 }
like image 88
Rishi Avatar answered Oct 25 '22 08:10

Rishi


Well, I fixed in a weird way. I read that some people where having this issue due to eCPM being to high or something like that. So, I went to my AdMob configuration to check it and everything seemed fine, but just in case I re-save the settings and violá, ads starting to work again.

This is the steps that I made:

  • Go to AdMob administration
  • Click on Monetize tab
  • Click on your problematic app
  • On the ad block, click on the link on the mediation column
  • Click on AdMod Network
  • Don't change anything, save data again

Hope this works for somebody...

like image 40
estemendoza Avatar answered Oct 25 '22 09:10

estemendoza