【问题标题】:Admob Rewarded Video: Displays in Xcode Simulator but not actual iPhoneAdmob 奖励视频:在 Xcode 模拟器中显示,但不是实际的 iPhone
【发布时间】:2017-03-14 04:31:03
【问题描述】:

我一直在寻找可能是一个非常简单的解决方法。我正在尝试显示 AdMob 奖励视频,而不是中介,只是 admob 网络视频。

我的视频在任何 Xcode 模拟器中都能完美播放并完美奖励用户。但是,当我在 iPhone 上运行该应用程序时,我在控制台中收到此错误:

找不到名称为 com.google.DummyAdapter 的广告网络适配器。请记住链接所有必需的广告网络适配器和 SDK,并在构建目标的“其他链接器标志”设置中设置 -ObjC。

我将在这里添加我所有的代码。如果您有任何想法,请告诉我!

-(IBAction)playRewardedVideo:(id)sender{
    //If the ad is loaded, play the ad
    if ([[GADRewardBasedVideoAd sharedInstance] isReady]) {
        [[GADRewardBasedVideoAd sharedInstance] presentFromRootViewController:self];
    } else {
        //if the ad is not loaded, load an AdMob rewarded video
        [GADRewardBasedVideoAd sharedInstance].delegate = self;
        [[GADRewardBasedVideoAd sharedInstance] loadRequest:[GADRequest request]
                                               withAdUnitID:@"My_AppUnitID_Here"];
    }
}
-(void)viewDidLoad{

    //preload an AdMob rewarded video upon View loading
    [GADRewardBasedVideoAd sharedInstance].delegate = self;
    [[GADRewardBasedVideoAd sharedInstance] loadRequest:[GADRequest request]
                                           withAdUnitID:@"My_AppUnitID_Here"];
}





- (void)rewardBasedVideoAd:(GADRewardBasedVideoAd *)rewardBasedVideoAd
//reward user for completing an AdMob RV
   didRewardUserWithReward:(GADAdReward *)reward {
    NSString *rewardMessage =
    [NSString stringWithFormat:@"Reward received with currency %@ , amount %lf",
     reward.type,
     [reward.amount doubleValue]];
    NSLog(rewardMessage);

    totalCoins = totalCoins + [reward.amount doubleValue];
    [[NSUserDefaults standardUserDefaults] setInteger:totalCoins forKey:@"SaveCoins"];

}

//Everything below is just NSLogs    
    - (void)rewardBasedVideoAdDidReceiveAd:(GADRewardBasedVideoAd *)rewardBasedVideoAd {
        NSLog(@"Reward based video ad is received.");
    }

- (void)rewardBasedVideoAdDidOpen:(GADRewardBasedVideoAd *)rewardBasedVideoAd {
    NSLog(@"Opened reward based video ad.");
}

- (void)rewardBasedVideoAdDidStartPlaying:(GADRewardBasedVideoAd *)rewardBasedVideoAd {
    NSLog(@"Reward based video ad started playing.");
}

- (void)rewardBasedVideoAdDidClose:(GADRewardBasedVideoAd *)rewardBasedVideoAd {
    NSLog(@"Reward based video ad is closed.");
}

- (void)rewardBasedVideoAdWillLeaveApplication:(GADRewardBasedVideoAd *)rewardBasedVideoAd {
    NSLog(@"Reward based video ad will leave application.");
}

- (void)rewardBasedVideoAd:(GADRewardBasedVideoAd *)rewardBasedVideoAd
    didFailToLoadWithError:(NSError *)error {
    NSLog(@"Reward based video ad failed to load.");

}

【问题讨论】:

  • 是的,我在链接器标志中添加了 -ObjC
  • @Jigar 我读了那篇文章,但为什么 AdMob 会有模拟器的库存,而不是我的 iPhone?我也没有地板套
  • 嗨@LodgeApps,您找到任何解决方案了吗?
  • @LucianoRodríguez 从来没有找到解决这个问题的办法......如果你这样做了,请告诉我!

标签: ios objective-c admob


【解决方案1】:

我遇到了同样的问题: 视频在模拟器和 iPad 上完美播放,无法在我的 iPhone 上显示。

为我解决这个问题的方法是在 iPhone Settings > Privacy > Advertising 下关闭 Limit Ad Tracking

⚠️ 注意:我的限制广告跟踪设置已经关闭!我必须将其打开并再次关闭才能生效。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多