首页 文章

离子 - 显示AdMob Banner /插页式广告(iOS)的问题

提问于
浏览
0

没有任何问题在Android设备上展示 Banner 广告和插页式广告,但在iOS设备上它们不会显示,只有页脚区域中的空白框并且没有弹出窗口 - 但是在模拟器上完美地运行,显示测试广告 .

在AdMob中 - 我只创建了一个应用程序(iOS),因此我只使用了两个广告单元ID( Banner 和非页内广告),这可能是问题还是?

你可以在下面看到我的代码:

import { Component } from '@angular/core';
import { Platform } from 'ionic-angular';
import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
import { AdMobFree, AdMobFreeBannerConfig, AdMobFreeInterstitialConfig } from '@ionic-native/admob-free';

import { ProjectlistPage } from '../pages/projectlist/projectlist';

@Component({
  templateUrl: 'app.html'
})
export class MyApp {
  rootPage:any = ProjectlistPage;

  constructor(platform: Platform, statusBar: StatusBar, splashScreen: SplashScreen, private admobFree : AdMobFree) {
    platform.ready().then(() => {
      statusBar.styleDefault();
      splashScreen.hide();
      this.showAdmobBannerAds();
      this.showAdmobInterstitialAds();

    });
  }

  showAdmobBannerAds(){
    const bannerConfig: AdMobFreeBannerConfig = {
        id: 'ca-app-pub-xxxxxx', 
        isTesting: false,
        autoShow: true,

      };
    this.admobFree.banner.config(bannerConfig);

    this.admobFree.banner.prepare()
    .then(() => {

        this.admobFree.banner.show();
    })
    .catch(e => console.log(e));    
    }


    showAdmobInterstitialAds(){
      const interstitialConfig: AdMobFreeInterstitialConfig = {
          id: 'ca-app-pub-xxxxxx', 
          isTesting: false,
          autoShow: true,

        };
        this.admobFree.interstitial.config(interstitialConfig);

        this.admobFree.interstitial.prepare()
        .then(() => {
            this.admobFree.interstitial.show();
        })
        .catch(e => console.log(e));    
      } 
}

有人有什么建议吗?

谢谢 .

1 回答

相关问题