我一直在寻找可能是一个非常简单的解决方案的时间。我正在尝试显示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.");
}
答案 0 :(得分:4)
我有同样的问题: 视频在模拟器和iPad上完美播放,无法在我的iPhone中显示它们。
为我解决的问题是iPhone 设置>隐私>广告并关闭限制广告跟踪。
⚠️注意:我的限制广告跟踪设置已经关闭!我必须将其打开然后再次关闭才能生效。