ratson / cordova-plugin-admob-free

New development has been moved to "admob-plus-cordova", https://github.com/admob-plus/admob-plus/tree/master/packages/cordova
https://github.com/admob-plus/admob-plus
MIT License
497 stars 212 forks source link

ERROR: Method 'createRewardVideo:' not defined in Plugin 'AdMob' in Xcode #127

Open qpbp opened 6 years ago

qpbp commented 6 years ago

Hi! The reward video not working on a real device (all is ok in Ionic DevApp).

I have the next method (i simplified the code), which is using to show RewardVideo:

import {
  AdMobFree, AdMobFreeRewardVideoConfig, AdMobFreeInterstitialConfig,
  AdMobFreeRewardVideo
} from '@ionic-native/admob-free';

 constructor(public admob: AdMobFree) {}

openReward (){
    let bannerConfig: AdMobFreeRewardVideoConfig = {
      isTesting: true, // Remove in production
      autoShow: true
    };

    this.admob.rewardVideo.config(bannerConfig);

    console.log('Reward Object', this.admob.rewardVideo);
    this.admob.rewardVideo.prepare().then((res)=>{
      console.log('Reward Video Prepared', res);
        return this.admob.rewardVideo.show();
      }
    ).then((res) => {
      console.log('Reward video is ok', res);
    }).catch((err)=>{
      console.log('Reward an issue', err);
    });

  }

When I successfully build the project using ionic cordova build ios and trying to call this method on a real device, I see the next log in Xcode Terminal:

2017-12-02 11:05:21.846332+0200 MyApp[2923:743276] {}
2017-12-02 11:05:21.847030+0200 MyApp[2923:743276] {}
2017-12-02 11:05:21.847526+0200 MyApp[2923:743276] ERROR: Method 'createRewardVideo:' not defined in Plugin 'AdMob'
2017-12-02 11:05:21.847707+0200 MyApp[2923:743276] FAILED pluginJSON = ["AdMob1760768413","AdMob","createRewardVideo",[{"autoShow":true,"isTesting":true}]]

Also, The simillar code related for interstital ads is working well.

Will be grateful for the help. Thank!

pdonaire1 commented 6 years ago

I think you need to set { id: adId,} in the bannerConfig.