iOS AdMob ads not showing up unless on Test Device - ios

I have followed the tutorial provided by Google here: https://developers.google.com/mobile-ads-sdk/docs/admob/ios/quick-start in order to setup admob banner ads.
My code is exactly how it is shown in the guide from the link above, so when I run the app on my test device or simulator a 'Smart Banner' 'Test Ad' appears..however, the second I remove the line of code below no banner appears at all..
request.testDevices = #[ #"70b9ee4e66c8e6fa26cb84def25706d9" ];
Also, I've loaded the app on another device and still there is no ad banner appearing, which makes me wonder when I submit the app to the App Store it only makes sense that all my users won't be seeing ads on their devices. Why is this happening? I've been scratching my head on this one! I don't want to submit it for review until I am certain everything is working correctly and I know that ads will appear not only on test devices but when the app goes LIVE as well. Thanks in advance! :)

-(void)adViewDidReceiveAd:(GADBannerView *)bannerView;
-(void)adView:(GADBannerView *)bannerView didFailToReceiveAdWithError:(GADRequestError *)error;
There can be number of reasons for not showing the Live ads.
Check your google admob account for the payment info. If not filled, fill it.
Check if your device is registered as test device, else you may get suspension from the google for 30 days or so.
You can check the delegate methods and print the logs:
In my case, I was getting error as { 'error': 'Request Error: No ad to show.', 'adType':'banner' }
But it showed at the client side, after I delivered to the client. So, I think that this issue was due to the reason that google had no advertisements in my region.

If you are working with iOS10, you should add this to your .plist:
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
<key>NSAllowsArbitraryLoadsForMedia</key>
<true/>
<key>NSAllowsArbitraryLoadsInWebContent</key>
<true/>
</dict>
Only test ads will appear otherwise. You can find more details about it at Firebase's Admob documentation.

Weird solution but it worked:
By following the guide provided by Google to setup Ad Mediation in iOS, it tells you to implememnt it via Storyboard/nib. Once I removed this method and simply implemented the GADBannerView programmatically, everything began to work as expected. Quite the annoying issue, but thankfully it's solved and I can move on.

I had this same issue.
My mistake was that I had created an app within AdMob for my Android application, which works great, however when it came to creating the app in iOS, all I did was create another ad unit under that same application. Doing that, gave me the same results that you are seeing.
To fix it, I created a new application inside AdMob that was for iOS platform, created an ad unit inside there and it solved my problem, I am now seeing real ads inside my app.

This not appear if will come up if you have limited ad tracking in your settings. On your device, check that Limit Ad Tracking is not enabled:
Settings -> Privacy -> Advertising

Have you registered an account with AdMob? If so, have you replaced the test Ad Unit ID that's included in the quick start with your own? If not, that would explain the behavior you're seeing (the ID in the example is only for test ads, and won't serve real ones).
An Ad Unit ID identifies an ad placement within your app, and is unique to you. The AdMob instructions for generating one are in their help documentation.

In my case it was actually due to the fact I was not using the correct ad unit ID (the part after the slash). I was able to find out as I used the sample IDs google provided, then I went to my admob account, click on the banner ad, I realized the two numbers for the plist (or initial setup in the app in app delegate) and for the ad unit are different. I spent probably hours on it :-(

I had the following error returned: "The ad request was successful, but no ad was returned due to lack of ad inventory." This can also explain why ads won't show up.

You registered your account in google admob account that I believed. You got your own test Id for your registered account. Follow the exact procedures and check the "self.bannerView.adUnitID" and also check the code "self.bannerView.rootViewController = self;" in objectice-c programming what you followed in your code.
Most important thing is to check the correct banner size which is default size.
Wishes for your success result.
Enjoy coding..

HERE'S A SOLUTION IF SOMEONE ELSE STILL LOOKING FOR IT.
bannerView = GADBannerView();
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers =
["YOUR DEVICE ID" ]
bannerView.adUnitID = "YOUR ADMOB ID"
bannerView.frame = CGRect(x: 0, y: screenHeight * 0.25, width: screenWidth, height: screenWidth * 0.2) // you can customise this
bannerView.rootViewController = self
let request = GADRequest()
bannerView.load(request)
self.view.addSubview(bannerView);

Related

Stop the UnityAds Cookie permission seeking

I've just added UnityAds to my app and whilst testing production I noticed instead of an ad, it popped up a request to place cookies on the users device.
The SDK integration was fine but is an absolute deal breaker for me. Is there any way to turn on a setting where it doesn't do this? I turned off the seek personalised ads request in the iOS app, I don't want my users interrupted like this. I'd like to reject all on their behalf before they see it.
Yes, you can do that. Use my following code to pass the consent flag to Unity Ads SDK. And make the Unity Ads SDK not request cookie permissions for your users by setting this flag to false
MetaData gdprMetaData = new MetaData("gdpr");
gdprMetaData.Set("consent", "false");
Advertisement.SetMetaData(gdprMetaData);
// then Setup Unity ads
For people who is using Ironsource Mediation and have Unity Ads in waterfall but having the same problem.
IronSource.Agent.setConsent(false);
Warrning: but if you do that, all ads will not be personalized. The best way I recommend to you is:
On first opening, You need to show ATT (Application Tracking Transparency) popup. Then if the user clicks Allow then you set the consent to true if the user clicks Don't allow (Require apps not to track) then you set the consent false.
by the way:
If you don't want to show ATT in the first time. You need to set consent as false until ATT shows
*** Edit *** Ok found it in Swift, posting the code for posterity - Magoo
let meta = UADSMetaData()
meta.setRaw("gdpr.consent", value: false)
meta.commit()

Google AdMob returns "Configuration does not have valid Google App ID"

It's been almost a week since my app went Live, but my live Google ads are not showing at all.
I've tried double checking everything I could think of, such as making sure the App ID and Ad ID are correct, but I'm having no luck with them.
I have the following 2 functions to load and show the ads
public func loadAd() {
interstitial = GADInterstitial(adUnitID: "ca-app-pub-3228561607874346/1546949023") //Live Ad 2
let request = GADRequest()
interstitial.load(request)
}
public func showAd() {
if (interstitial.isReady) {
interstitial.present(fromRootViewController: self)
loadAd()
} else {
print("Ad wasn't ready")
}
}
I tried running it with test ads using the test ad ID that were given to me on Google's tutorial page and that seems to be working fine, just not my Live Ad.
The only thing that flags or catch my attention is the console is printing:
[I-ACS023136] Configuration does not have valid Google App ID.
and
[I-ACS034010] Transaction failed
But like I said, I double checked my config in my info.plist file and all seems to be fine.
There are over 200 requests made and 0% match-rate. I just don't know what it could be.
I've done some research and most people solved their issues related to AdMob by waiting a few days. Since your app went live more than a week ago, I believe that's not the issue. Another possible solution is to share your app with more people, in order to send more requests to Google Servers. According to this answer:
For newly created ads to work, Admob need more requests to start showing ads.
Also:
Make sure that Google Mobile Ads SDK is properly integrated.
Make sure that you are using the Real ID because sometimes the Test ID is used by default.
Make sure there are no restrictions on your account.
Make sure that the account setup is fully completed. Payment information, name, address, phone number, and tax info in your AdMob account with verification if applicable.
Check that the eCPM floor settings are not set too high.
An unlikely but possible reason could be lack of inventory.
If none of the above worked, you can try these troubleshooters:
Performance Troubleshoot - Can't see ADS Troubleshoot
More info:
Common reasons for ads not showing
Your code loads the interstitial ad inside the if condition.
Call your load before you check if it is ready.
interstitial.isReady indicates that the ad is fully loaded.
You can see this website for more information: https://developers.google.com/admob/ios/interstitial.
It is also better practice to call loadAd function in viewDidLoad and display it when needed.
I also recommend using the test id for Google Admob.
It is listed in the url: https://developers.google.com/admob/ios/test-ads
Don't forget to include Admob App Id in GoogleService-Info.plist. I think it is included automatically, but you can check it.

Unable to get FBNativeAd Test Ad working in our iOS App

We have an iOS App (SWIFT 4) where we want to integrate Facebook Audience Network for Native Ad. Following the instructions at https://developers.facebook.com/docs/audience-network/ios (EXCEPT for entering "Payment info" in our Facebook Business account as we are in development phase still), https://developers.facebook.com/docs/audience-network/ios-native and https://developers.facebook.com/docs/audience-network/testing#testing-testAd our code (in ViewController viewDidLoad()) to load a TEST AD is as follows:
let nativeAd = FBNativeAd(placementID: "IMG_16_9_LINK#" + "OUR_PLACEMENT_ID" )
nativeAd.delegate = self
nativeAd.mediaCachePolicy = FBNativeAdsCachePolicy.all
nativeAd.load()
But FBNativeAdDelegate callback does not fire.
func nativeAdDidLoad(_ nativeAd: FBNativeAd) {
...
}
Using Facebook -> Manage Property -> Property Settings -> Ad Request Debugger, there is no request reaching the Server for reasons unknown. In our App "info.plist" file "App Transport Security" has property "Allow Arbitrary Loads" enabled (YES) just in case.
We have tried both Simulator on Mac as well as iPhone/iPad where Facebook App was logged in as the SAME user with the Business Account matching OUR_PLACEMENT_ID.
Any help to resolve the mystery will be highly appreciated.
Thanks!
It started working after set Key NSAllowsArbitraryLoadsForMedia to YES under App Transport Security in Info.plist! Note that this key will have to be manually added as it is not available as a default in XCode editor.
How I wish Facebook had clear documentation on this which would've saved 2 days of wasted effort!

How to disable the test ads in admob to get live ads in IOS application

We are using admob for to post our own ads in IOS app.
We created an admob account and created a campaign ad. And implemented in IOS app. Still i get test ad only in testflight also.
I searched for this and get the below link
How do I turn off admob testing
As per this directions i was not able to find path
Sites And Apps ->Manage Setting->App Setting->Test Mode->Disable test mode for all requests
Please suggest me.
Thank you.
Remove the testDevices. For example:
let request = GADRequest()
// request.testDevices = ["2077ef9a63d2b398840261c8221a0c9b"]
From Targeting - Test ads:
Be sure to remove the code that sets these test device IDs before you
release your app.

iOS App Metadata Rejected? Anything to Check in ViewDidLoad?

So I just got an app's metadata rejected. Their message:
Your iTunes Connect settings indicate that your app serves third-party advertisements. However, we were unable to locate ads in your app.
Please reply to this message to provide the steps for locating third-party ads in your app. When we hear back from you, we will continue the review.
But my app presents a google adBanner as soon as they game is launched. Even if you somehow press the start button before the Ad is loaded, it still presents itself during the game...
Is there any reason they wouldn't see the AdBanner?
I have my own adUnitID and it displays an Ad on my iPhone 6+ device and also the 4S simulator...
Also, I ticked the "servers advertisements within app" check box before submitting:
I've replied saying:
Hello.
Please see screenshot of a Google AdBanner... It should show upon launch of the game.
Steps:
-Open App
-An Ad should load within seconds.
Please advise. Thanks.
and attached a screenshot, showing it...
I've done it the same way I have in my last app which is live and serving ads.
This is how I load and serve the ad in the gameViewController:
override func viewDidLoad() {
super.viewDidLoad()
googleBannerView = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)
googleBannerView.adUnitID = "ca-app-pub-blahblahblah/1010101"
googleBannerView.rootViewController = self
let request: GADRequest = GADRequest()
googleBannerView.loadRequest(request)
googleBannerView.frame = CGRectMake(0, view.bounds.height -googleBannerView.frame.size.height, googleBannerView.frame.size.width, googleBannerView.frame.size.height)
self.view.addSubview(googleBannerView!)
//more stuff
}
Is there anything else I can do to check in the code that it's definitely serving ads? I can't see anything wrong with it.
I can't think of any reason it wouldn't be serving their end...
Also, if it's still in review, do I have to wait another week?
Metadata rejected in itunesconnect means 1) that something wrong with app metadata (description, screenshots, etc.) or 2) Something wrong with things that are serving your app (backend, some authorization, etc.). Also it means that you can resubmit your app without uploading new app binary file. Seems like the second case is yours, and the app review team thinks that something went wrong with you ad serving or ad banner in the place that they couldn't find.
I recently got this rejection when they couldn't find my third party ad, Admob, in my app. This was because I was using admob just for interstitial and I used iAd for banners. I had to tell them how and where to get those admob ads to show.
you can try googleBannerView.hidden = false (this is the default value) and see if there's a difference
But for your case, since you're using admob banners that should have shown in the first place and you were able to make it show on your test, the only reason I could think of why they did not find it is because of no ad inventory from Admob (I stated this reason as well when I replied) which is rare but still happens.
It will stay in review/rejected state until you fix it by uploading a new binary and resubmitting (which would take the normal week submission and reviewing) or when they are convinced that there is a third party ad network used (from replying and stating your case) which they'll change the app status to 'ready for sale' or approved. Mine took 2 days I think.

Resources