简体   繁体   English

Admob奖励视频:在Xcode Simulator中显示,但在实际的iPhone中不显示

[英]Admob Rewarded Video: Displays in Xcode Simulator but not actual iPhone

I've been searching for hours for what is probably a very simple fix. 我一直在寻找可能很简单的修复方法的小时。 I am trying to display AdMob rewarded videos, not mediated, just admob network videos. 我正在尝试显示AdMob奖励的视频,而不是中介的视频,而只是admob的网络视频。

My videos play perfectly and reward the user perfectly in any Xcode simulator. 我的视频在任何Xcode模拟器中都能完美播放,并能完美地奖励用户。 However, when I run the app on my iPhone, I get this error in the console: 但是,当我在iPhone上运行该应用程序时,在控制台中出现此错误:

Cannot find an ad network adapter with the name(s): com.google.DummyAdapter. 找不到名称为com.google.DummyAdapter的广告网络适配器。 Remember to link all required ad network adapters and SDKs, and set -ObjC in the 'Other Linker Flags' setting of your build target. 记住要链接所有必需的广告网络适配器和SDK,并在构建目标的“其他链接器标志”设置中设置-ObjC。

I will add all my code here. 我将在此处添加所有代码。 Please let me know if you have any ideas! 如果您有任何想法,请告诉我!

-(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.");

}

I had the same issue: video plays perfectly on simulators and iPad, no way to display them in my iPhone. 我遇到了同样的问题:视频可以在模拟器和iPad上完美播放,而无法在iPhone上显示它们。

What solved it for me was going under the iPhone Settings > Privacy > Advertising and turn off Limit Ad Tracking . 为我解决的是转到iPhone 设置>隐私>广告 ,然后关闭限制广告跟踪

⚠️ Note: The Limit Ad Tracking setting for me was turned off already! Note️注意:我的 “限制广告跟踪”设置已关闭! I had to turn it ON and back OFF again to take effect. 我必须将其打开然后再次关闭才能生效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM