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
Related
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.
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
The problem is that Apple rejects my app because when the button is clicked to purchase the "no ads" upgrade, it doesn't make the banner disappear until you close the app and re-open it. This is because I initialize all my RevMob code in the viewController.swift file. I have a boolean in place that turns to false as soon as the upgrade is purchase inside this viewController.swift file. So next time you open the app and the viewController loads, the boolean is set to false and it doesn't allow the ads to appear.
Anybody know if this is the wrong way to go about this? Or is there an easy way to make them disappear immediately upon press of the no Ads button without having to close the app and re-open it?
//BANNER AD =======================================
let bannerBlock: () -> Void = {
//Custom method defined below
if UserDefaults.standard.object(forKey: "adsBool") as! Bool == true
{
self.showBannerWithCustomFrame()
}
else
{
//don't show ads because user purchased
}
}
let bannerFailBlock: ((Error?) -> Void) = {error in
NSLog("[RevMob Sample App] Session failed to start with error: \(error!.localizedDescription)")
}
RevMobAds.startSession(withAppID: "00000000000000000000",
withSuccessHandler: bannerBlock,
andFailHandler: bannerFailBlock)
This is how my bannerView is set up in my GameViewController
class GameViewController: UIViewController, RevMobAdsDelegate {
var bannerView:RevMobBannerView?
override func viewDidLoad() {
super.viewDidLoad()
From RevMob's banner documentation, there's a method called hideAd. Calling that method on the IAP callback would solve your problem right?
To hide the banner:
banner!.hideAd()
Let me see if i got your problem correctly, you want to hide your banner as soon as the purchase is made.
First, you need to set the bannerView as a property of your viewController.
Then you have to add this code inside the callback from the purchase success:
viewController.bannerView.removeFromSuperview();
I fixed it! Thanks for your help. I had to move the code from the GameViewController to the GameScene for the bannerAd so that I could remove it as soon as the purchase was made. Works perfectly.
I'm trying to add AdMob to my app.
My app is build with :
UITabBarController with 1. UIViewController; 2. UITableViewController; 3. UIViewController; 4. UIViewController.
I'm actually tring to add a Banner Ad from Admob in the 3. UIViewController.
I used that code:
#IBOutlet weak var amobBan: GADBannerView!
[•••]
amobBan.delegate = self
amobBan.adUnitID = "ca-app-pub-xxxxxxx" // I used mine in other apps : it works.
amobBan.rootViewController = self // NB: I also tried with tabBarController istead "self"
amobBan.loadRequest(GADRequest())
And it not works : ad isn't displayed.
So I used that function:
func adView(bannerView: GADBannerView!,
didFailToReceiveAdWithError error: GADRequestError!) {
print("adView:didFailToReceiveAdWithError: \(error.localizedDescription)")
}
And I got this output:
adView:didFailToReceiveAdWithError: Request Error: No ad to show.
I really think it's due to amobBan.rootViewController = self since Ad is showed when I set the 3. UIViewController as the Initial ViewController into the Storyboard.
I need answers in Swift, please.
Add your test devices - real devices and the simulator. You may find your test device string in Xcode output pane.
let request: GADRequest = GADRequest()
request.testDevices = [ "661359a1bfeb6e588caf9c8133904d10", "96a6d0a80ffaa7094ad91b6648b6b50f", kGADSimulatorID ]
bannerView.load(request)
Late answer but this may helps to other.
If you are facing issue like "No ad to show" in cases if you are using google banner ads(admob) then that issue solved by making view width 320 fixed.I solved my issue by making ad width 320 and height 50.
Hope this will helpful for others.
Use a test ad unit id, or add a test device
Google's documentation is pretty straight forward so maybe you should take a look into it.
https://developers.google.com/admob/ios/banner
At first glance I have a question:
Are you configuring AdMob in your AppDelegate didFinishLaunching?
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Initialize the Google Mobile Ads SDK.
// Sample AdMob app ID: ca-app-pub-3940256099942544~1458002511
GADMobileAds.configure(withApplicationID: "YOUR_ADMOB_APP_ID")
return true
}
Some tips, like Payal Umraliya said, size is a pretty big deal in admob, so make sure adview has the same size of the ad you are requesting.
I just integrated iAds into my app and they work perfectly. The only problem is that there is a delay on the page before the ad shows up. I'd like to preload the ads as soon as the app is launched. I have one medium rectangle ad and one regular banner ad (on different views in the app).
Medium rectangle is loaded on viewDidLoad() of ReadingVC.swift like this:
var rectangleAdView = ADBannerView(adType: ADAdType.MediumRectangle)
// Show banner ad
rectangleAdView?.delegate = self
With the following functions:
func bannerViewDidLoadAd(banner: ADBannerView!) {
println("bannerViewDidLoadAd - Ad shown on app")
self.view.addSubview(banner)
self.view.layoutIfNeeded()
}
func bannerView(banner: ADBannerView!, didFailToReceiveAdWithError
error: NSError!) {
banner.removeFromSuperview()
self.view.layoutIfNeeded()
}
The regular banner is loaded on viewDidLoad() of LibraryVC.swift in the same fashion, just with ADAdType.Banner instead of ADAdType.MediumRectangle
How can this be done?
There will always be a bit of a delay because the application has to grab the ads from the iAd CDN. Now, if you have a view that shows before either ReadingVC and LibraryVC, you can always try to load the ads there beforehand. To do this, you'd probably need to create a separate singleton class to hold all of your iAd code, and then access that class from all of the places you need to display or try to preload an iAd.