Reputation: 344
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.
My videos play perfectly and reward the user perfectly in any Xcode simulator. However, when I run the app on my iPhone, I get this error in the console:
Cannot find an ad network adapter with the name(s): 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.
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.");
}
Upvotes: 2
Views: 1226
Reputation: 3451
I had the same issue: video plays perfectly on simulators and iPad, no way to display them in my iPhone.
What solved it for me was going under the iPhone Settings > Privacy > Advertising and turn off Limit Ad Tracking.
⚠️ Note: The Limit Ad Tracking setting for me was turned off already! I had to turn it ON and back OFF again to take effect.
Upvotes: 5