Hi Alex here from rebeloper.com and in this video I am going to show you how to
show an AdMob interstitial ad in your iOS projects in xcode 9. So without
further ado let's dive in!
Now in the latest episode I have shown you how easy
it is to show a banner ad inside Xcode with the help of the AdMob SDK or if
you might remember with the help of the Smart AdMob framework that I have
created only one single line of code. So to do the same for the interstitial
it's a little bit tricky but not that much. First of all we need to create and
load it and then we can present it at our choice. So first up we need to create
and load an interstitial. Okay, let's go here in our create and load interstitial
file, that is called in the viewDidLoad that is when the viewController was
presented and the viewDidLoad. So let's type in: addMobCreateAndLoadInterstitial.
Let's hit return on that and a big chunk of code has jumped right
in and I will just go through each and every one of that. So we are in creating
an interstitial GAD interstitial. And we are assigning it to the interstitial
that we have declared up here. Okay, and of course with the AdMob interstitial ad
unit ID. We are setting the test devices for our request that we have created of
course. And then we are loading the request upon our interstitial.
Okay, next up now that we have loaded the view and created and loaded an
interstitial we are going to present it at a touch of a button. So next up is
present interstitial, okay. Now we need to check, if the interstitial
is ready because maybe it is still not maybe we did not have an interstitial to
be loaded. So if it is ready then we are going to present it from the root
controller of course and if not we will print out interstitial ad wasn't ready
and of course we are going to fetch another interstitial we are going to
call create and a load interstitial. Now first time of these calls may not come
right in for our simulator so let's just test it
out and see what happens. We are going to just wait a little bit
let it move in, okay. Just a few seconds and now let's just
press on a tap on present interstitial ad. And luckily we did get displaying
interstitial. Don't worry this issue is only for testing.
It will get an interstitial when your app is live. So that is how easy it is to
add an interstitial ad inside your Xcode iOS project. So if you want to make it
even easier I have created the Smart AdMob Framework and let me just show you
how easy it is to show an interstitial ad. And you don't have to go all over all
this. So first of all you don't even need to fetch so called fetch the loading
section. You just need to have one line of code and that is smart AdMob shared
show interstitial ad on self the view controller with frequency and that is
for the preset and of course you can set the frequency. So you don't even want to...
you don't want to show the interstitial ad on every load of our viewController
you want to avoid a few presentations. Let's say if you want to
show on the every third presentation of our shop view then you can do this with
the help of smart AdMob and by the way this can be set to preset and it can
set to be always. So you may choose to your liking and that is all only one
line of code the rest is all taken care of the smart AdMob which you can find in
The Tribe and hopefully you got email with the link where you can find a very
hefty discount on The Tribe only for our YouTube subscribers. So that is how you
can add interstitial ads from AdMob into your Xcode projects. Hope you like this
video, if you did go ahead and hit the thumbs up and if you would like to see
more videos from me like this one go ahead and click on the subscribe button
down below and I will see you in the next one!