Skip to content

Hotfix/onRewaded does not work on iOS#43

Open
zumikou1125 wants to merge 2 commits intoko2ic:masterfrom
zumikou1125:hotfix/onRewaded-does-not-work-on-ios
Open

Hotfix/onRewaded does not work on iOS#43
zumikou1125 wants to merge 2 commits intoko2ic:masterfrom
zumikou1125:hotfix/onRewaded-does-not-work-on-ios

Conversation

@zumikou1125
Copy link

Overview

Fixed an error in the "onRewarded" callback function on iOS.

Modifications

  • A typo in the "type" key in the native code ( "yype" -> "type" )

    • ios > Classes > RewardedAd.swift

      func rewardBasedVideoAd(_: GADRewardBasedVideoAd,
                              didRewardUserWith reward: GADAdReward) {
          // before
          channel.invokeMethod("onRewarded", arguments: ["yype": reward.type, "amount": reward.amount])
          // after
          channel.invokeMethod("onRewarded", arguments: ["type": reward.type, "amount": reward.amount])
      }
  • Invalid cast error ( type 'double' is not a subtype of type 'int' in type cast )

    • lib > rewarded_ad.dart

      // before
      final void Function(String type, int amount) onRewarded;
      // after
      final void Function(String type, double amount) onRewarded;
      
          :
          :
          
      case 'onRewarded':
          var type = call.arguments['type'] as String;
          // before
          var amount = call.arguments['amount'] as int;
          // after
          var amount = call.arguments['amount'] as double;
          this.onRewarded(type, amount);
          break;
    • example > lib > main.dart

      // before
      onRewarded: (String type, int amount) {
      // after
      onRewarded: (String type, double amount) {
          print('rewardedAd onRewarded: type:$type amount:$amount');
      },

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant