Search code examples
iosobjective-cadmobiad

How to show iad or admob in the whole view


i did a game in IOS mobiles, and i add iAd and when it fails ad-mob will be shown. in my game there is a function called GameOver Whenever the user loss this function will be called. Now what i want is how i can add advertisement in the whole view when the user loss the advertisement in the whole view will be shown.

As you can see in app-store, there are games when the user loss, a view popup and it contain an advertisement and a video. I tried to do it, but the only thing that I'm getting is a small banner for iAd.


Solution

  • you can use this for full view

    - (void)createAndLoadInterstitial
    {
     self.interstitial = [[GADInterstitial alloc] init];
     self.interstitial.adUnitID = @"ca-xxx-xxx-xxxxxxxxxxxxxxxxxxxx";
     self.interstitial.delegate = self;
    
    GADRequest *request = [GADRequest request];
    request.testDevices = @[
    @"xxxxxxxxxxxxxxxxxxxxxxx"  
    ];
    [self.interstitial loadRequest:request];
    }
    
    
    
    #pragma mark GADInterstitialDelegate implementation
    
    - (void)interstitial:(GADInterstitial *)interstitial
    didFailToReceiveAdWithError:(GADRequestError *)error {
      NSLog(@"interstitialDidFailToReceiveAdWithError: %@", [error localizedDescription]);
        }
    
    - (void)interstitialDidDismissScreen:(GADInterstitial *)interstitial{
     NSLog(@"interstitialDidDismissScreen");
     //do you work
    }
    

    and framework - GoogleMobileAds