Reputation: 9
I'm trying to integrate firebase/admob ads for ios app using Cocoapods. On Cocaopods site there is a guide such as downloading Cocoapods first then creating a pod file in the app and adding a code using pods. On Google site there are also instructions on how to install firebase ads sdk using pods but then it seems that I also need to insert coding such as gad etc in the actual application. I'm new to this, so I'm a bit confused - is Cocoapods coding enough or do I also need to add coding in the application as well in terms of initializing ads or creating buttons for specific ads such as banner/interstitial etc?
Upvotes: 0
Views: 315
Reputation: 9
Also, I think the code is in C that's why I had problems with it and not Swift. I've managed to get almost everything done - I have a problem when I use self.bannerView and also GADBannerView with messages that it hasn't been declared previously. I tried to follow Objective C because that's how the code looks like, but don't seem to be able to resolve this.
Upvotes: 0
Reputation: 693
You have to add some coding in the app as well such that importing the Googlemobileads in the app delegate and configuring it in the func didFinishLaunchingWithOptions:
GADMobileAds.configure(withApplicationID: "Your application id")
and then adding the below code in your first controller or the controller in which you want to show the adds:
var bannerView: GADBannerView!
bannerView = GADBannerView(adSize: kGADAdSizeSmartBannerPortrait)
bannerView.frame.origin.y = self.view.frame.size.height - bannerView.frame.size.height
self.view.addSubview(bannerView)
bannerView.adUnitID = "Your ad unit id"
bannerView.rootViewController = self
bannerView.load(GADRequest())
Upvotes: 0