Admob iOS test ads in release build - ios

I have the next issue with admob. I created app for iOS 8 in swift using the latest admob sdk and I when I debug this app on the simulator I see test ads, when I debug on the real device I see the real ads. But when I published the app to the app store I see test ads.
I have not set up any test ads on the device or in the account adb it must show ads in simulator only, but I see test ads in release build on the AppStore.
Maybe I doing something wrong? I have not requested testing on any device so it must show me real ads on any real device but it does not.
My code
override func viewDidLoad() {
super.viewDidLoad()
self.bannerView.adUnitID = "my id"
self.bannerView.rootViewController = self
var request:GADRequest = GADRequest()
self.bannerView.loadRequest(request)
//other setup code which is not related to ads
let tracker = GAI.sharedInstance().defaultTracker
let build = GAIDictionaryBuilder.createAppView().set("Custom event", forKey: kGAIScreenName).build() as NSDictionary
tracker.send(build as [NSObject : AnyObject])
}
Other controller
override func viewDidLoad() {
super.viewDidLoad()
var interstitial : GADInterstitial = GADInterstitial()
interstitial.adUnitID = "interstitial ad id"
var request: GADRequest = GADRequest()
interstitial.loadRequest(request)
//other setup code not related to ads
}

I was provided by wrong advertiser id. So fix is obvious - just recheck your ad unit id before release.

Related

Why are AdMob test ads appearing on my app but the actual ads are no longer showing up?

I have an app that I want to display a banner ad on the bottom of the screen. Test ads are appearing, and the following code used to work for real ads. Unfortunately, my AdMob account got suspended, but when it was reinstated I expected the ads to begin appearing again. I still have not seen any banner ads appear even though test ads still work.
class GameViewController: UIViewController, GADBannerViewDelegate {
private let banner: GADBannerView = {
GADMobileAds.sharedInstance().requestConfiguration.testDeviceIdentifiers = [myTestIDString]
let banner = GADBannerView()
banner.adUnitID = AdMob.bannerid
let request = GADRequest()
banner.load(request)
return banner
}()
override var prefersStatusBarHidden: Bool {
return true
}
override func viewDidLoad() {
super.viewDidLoad()
//adds AdMob BannerAd to view
banner.rootViewController = self
banner.delegate = self
view.addSubview(banner)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
banner.frame = CGRect(x: 0, y: view.frame.size.height-50, width: view.frame.size.width, height: 50).integral
}
}
I am getting the following error even though I added -ObjC in 'Other Linker Flags' setting of your build target.
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.
Is there a reason real ads are still not appearing? It has been nearly a month since my account was reinstated.
Here is a few things you can try.
Make sure your pod file is up to date with the latest pod 'Google-Mobile-Ads-SDK'
Make sure your "App Privacy" is correct as adMob ads collect lots of data from your users. Here is a tutorial - https://levelup.gitconnected.com/filling-out-the-app-privacy-section-in-app-store-connect-for-admob-users-bca0768ad86e?gi=aa4b25a3518e
Set your eCPM Floor to disabled in your ad unit settings.
If you do use mediation, make sure your ad network adapter is up to date and installed.
As per this link https://stackoverflow.com/a/35227668/14482253. Re-add your ad units.

Live Admob Ads have suddenly stopped displaying in my app

In June, Admob adverts worked perfectly and AdMob sent a letter with a verification PIN for me to verify my identity & payment details.
Around the beginning of July, nearly all live ads stopped displaying in my app. I am still making the same number of requests, but impressions are so low I have dropped to £0.00/£0.01 a day. All test ads work correctly.
This issue began around the time I renamed my app (only on the app store display), however; all links to my app in my AdMob account are correct so the name change appears to have made no difference on their front-end UI.
When I debug my app, I get a list of warnings in the output section:
[I-ACS025031] AdMob App ID changed. Original, new: (nil), AppId
My 'GADApplicationIdentifier' value in my info.plist is the same as the 'new' app id.
[I-ACS013003] User property name must start with a letter: _ap
I am not setting any user properties, no idea what this means.
What have I tried?
Setting up new ad units.
Reverting back to an older version of the app.
Contacted AdMob 'support' via a form. They told me my ad serving is being limited. They did not say for how long and it has been around 2/3 weeks (by 'limited', I don't think they meant completely stopped).
Checked for policy violations in my account; nothing is there.
Code I use to display ads:
I have created an 'AdMobDisplayer' class that allows me to set up and display ads; this is called by each view controller. For example, my banner ads code:
View Controller:
let adMobDisplayer = AdMobDisplayer()
#IBOutlet weak var bannerView: GADBannerView!
override func viewDidLoad() {
super.viewDidLoad()
self.bannerView = self.adMobDisplayer.setupAdBannerView(self.bannerView, viewController: self, adUnitId: Constants.timerTabBannerAdId)
self.adMobDisplayer.displayBannerAd(self.bannerView)
}
AdMobDisplayer:
func setupAdBannerView(_ bannerView: GADBannerView, viewController: UIViewController, adUnitId: String, bannerViewDelgate: GADBannerViewDelegate? = nil) -> GADBannerView {
if(checkIfAdsAreDisabled()) {
return bannerView
}
/// Creates a new GADBannerView to be displayed in a view controller
bannerView.adUnitID = adUnitId
/// bannerView.adUnitID = Constants.testBannerAdId
bannerView.rootViewController = viewController
if let delegate = bannerViewDelgate {
bannerView.delegate = delegate
}
return bannerView
}
func displayBannerAd(_ bannerView: GADBannerView) {
if(checkIfAdsAreDisabled()) {
return
}
///Creates a request and loads an advert from AdMob
let request = GADRequest()
request.testDevices = [ "My Device Id" ]
bannerView.load(request)
}
This should display a banner ad in the view. It worked when I first added adverts in, it works for test adverts, but intermittently/rarely for live adverts now.
Find the full application on my GitHub: https://github.com/AlexMarchant98/KeGal-Trainer
Thanks in advance for any help!
I recently worked on GADBannerView in my last app and had almost similar issue, in your case you may need to generate Admob ad id, from their website.
So I fixed this ages ago, but, my fix was to add the required 'NSAppTransportSecurity' keys into my info.plist.
https://developers.google.com/admob/ios/app-transport-security

AdMob Banner in ShareSheet

Is there any restriction that it is not possible to display a bannerview from Google Admob in a sharesheet? I have an app which provides additional data in the sharesheet, and I also want to display ads there. In my main app, the ads work fine - but in the sharesheet, I don't get any error message or anything when initialising the ads.
Greetings,
Jack
Update: I am using the cocoapod Firebase/Admob. This one is assigned to the main app and the sharesheet. As I have the ads on several view controlers, I created a function, which is connected via an app group to both parts. In ViewDidLoad, I initialice google admob
GADMobileAds.configure(withApplicationID: "filledwiththecorrectcode")
Then I run this function providing the view and the constrains:
func loadAdd(ViewController: GADBannerView, HightConstrain: NSLayoutConstraint, MainApp: Bool){
ViewController.adSize = kGADAdSizeSmartBannerPortrait
// TEST CODE
ViewController.adUnitID = "ca-app-pub-3940256099942544/2934735716"
ViewController.rootViewController = self
HightConstrain.constant = 50
let request: GADRequest = GADRequest()
request.testDevices = [kGADSimulatorID]
ViewController.load(request)
}
}
This works fine in the main app. In the sharesheet, I run the same function - it also walks through in the debugger, but nothing happens. Ah, the

Firebase Banner Ad not loading

I've implemented Firebase and originally had ad banners loading fine. But at some point along the way they have stopped showing up and i've tried everything i can think of. I have no idea what i could have changed as not much is different and certainly nothing with the Firebase or AdMob code has changed.
print("Google Mobile Ads SDK version: " + GADRequest.sdkVersion())
bannerView.adUnitID = "ca-app-pub-6956068899232786/3635179951"
bannerView.rootViewController = self
let request = GADRequest()
request.testDevices = [kGADSimulatorID]
bannerView.loadRequest(request)
I have also tried implementing the adViewDidReceiveAd() delegate function and i'm not seeing that get called either.
adViewDidReceiveAd did not call because you forget add
bannerView.delegate = self

Test AdMob banner adViewWillPresentScreen method without creating false ad impressions

I've implemented AdMob in to my application, but I'd like to ensure that the logic in the adViewWillPresentScreen: and adViewDidDismissScreen: methods are correct.
I have added my device's ID as a test device, so that I am only displayed test adverts. However, when I tap on the test advert, I am taken directly out of the app, rather than a screen (such as the App Store) being displayed. This means that the above methods are not being fired, and I am unsure how to test them without removing my device from the array of test devices and creating a false impression by tapping on one of my own ads - potentially repeatably while debugging.
Code creating banner:
let bannerView = GADBannerView(adSize: size)
bannerView.delegate = self
bannerView.adUnitID = "<redacted>"
bannerView.rootViewController = rootViewController
let request = GADRequest()
request.testDevices = [
kGADSimulatorID,
"<redacted>" // Test device
]
bannerView.loadRequest(request)
I have also tried an example adUnitID (ca-app-pub-3940256099942544/6300978111), which even when my device is not in the array of test devices displayed the example advert.

Resources