tamtoum1987 tamtoum1987 - 1 month ago 18
iOS Question

How to use GADRewardBasedVideoAd

I want to add reward ads in my application, when user watch the ads video i will give him a reward

what i try to do is something like this
in viewdidload i initialize like this :

let rewardedVideo : GADRewardBasedVideoAd =
GADRewardBasedVideoAd.sharedInstance()
rewardedVideo.delegate = self
let request2 : GADRequest = GADRequest()
request.testDevices = [kGADSimulatorID, "id_device"]
rewardedVideo.load(request2, withAdUnitID: "id reward video from admob")


and later in the application when user decide to play video ads i check this :

if GADRewardBasedVideoAd.sharedInstance().isReady {

GADRewardBasedVideoAd.sharedInstance().present(fromRootViewController: self)
}


the problem is GADRewardBasedVideoAd.sharedInstance().isReady is alway no ready

how can i resolve this problem please ?

any help will be appreciated

___________________Edit

I added this

func rewardBasedVideoAd(_ rewardBasedVideoAd: GADRewardBasedVideoAd, didFailToLoadWithError error: Error?) {
print("error \(error)")
}


and i can see error : Request Error: No ad to show

i don't know may be i miss a configuration

--------------Edit

Solution i used:

like @Daniel Storm suggested, i have to configure third party ad networks for GADRewardBasedVideoAd but when i tried to connect AdColony and Applovin to admob its give me error, somehow adapter it s not connected correcety, i finally choise to integrate chartboost independally of admob, so now i have chartboost for resward video and and admob for banner and intertitiel

i add chartboost like this :

Chartboost.start(withAppId: "appid configurad in https://dashboard.chartboost.com", appSignature: "signature in the same site", delegate: self)
Chartboost.cacheRewardedVideo(CBLocationMainMenu)


if(Chartboost.hasRewardedVideo(CBLocationMainMenu)){


Chartboost.showRewardedVideo(CBLocationMainMenu)

Answer

You have to setup and use third party ad networks for GADRewardBasedVideoAd on AdMob.com.

From Rewarded Video: Publishers Get Started:

Rewarded ads are only available from third-party networks that you've selected for mediation.

Comments