iOS Development

Advert did fail to current full display screen content material whereas exhibiting Interstitial Google adverts exhibits the error for me in iOS goal -C

Spread the love


I get this error and my code is beneath

 - (void)viewWillAppear:(BOOL)animated {
      NSLog(@"self.inter eve reload cl %@", self.interstitial);
      DebugAssert(index != NSNotFound);
      double delayInSeconds = 5.0;
      dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC));
           if (!didPurchaseAds) {
                dispatch_after(popTime, dispatch_get_main_queue(), ^(void){
                NSLog(@"Interstitial advert loaded %ld", (lengthy)index);
                    if ((index % 2 == 0)) {
                         NSLog(@"Interstitial advert loaded for even num %ld", (lengthy)index);
                            if (self.interstitial) {
                                NSLog(@"Present InterstitialAd %@", self.interstitial);
                                [self.interstitial presentFromRootViewController:self];
                                [self.interstitial presentFromRootViewController:self];
                              } else {
                                NSLog(@"Advert wasn't prepared occasion");
                           }
                        }
                  });
          }
    }
    
    - (void)viewDidLoad{
       [super viewDidLoad];
        [self loadInterstitial];
    }
    
    - (void)loadInterstitial {
            GADRequest *request = [GADRequest request];
            [GADInterstitialAd loadWithAdUnitID:@"ca-app-pub-3940256099942544/4411468910"
                                        request:request
                              completionHandler:^(GADInterstitialAd *ad, NSError *error) {
                if (error) {
                    NSLog(@"Failed to load interstitial ad with error: %@", [error localizedDescription]);
                    return;
                }
                self.interstitial = advert;
                self.interstitial.fullScreenContentDelegate = self;
            }];
        }
    
    
    - (void)advert:(nonnull id<GADFullScreenPresentingAd>)advert
    didFailToPresentFullScreenContentWithError:(nonnull NSError *)error {
        NSLog(@"Advert did fail to current full display screen content material.");
    }
    
    /// Tells the delegate that the advert will current full display screen content material.
    - (void)adWillPresentFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)advert {
        NSLog(@"Advert will current full display screen content material.");
    }
    
    /// Tells the delegate that the advert dismissed full display screen content material.
    - (void)adDidDismissFullScreenContent:(nonnull id<GADFullScreenPresentingAd>)advert {
       NSLog(@"Advert did dismiss full display screen content material.");
    }
    
  

 

Leave a Reply

Your email address will not be published. Required fields are marked *