0

I am following this tutorial however I cannot figure out how to set the delegate. I have everything else set up and the ad is displaying but I can not run any code when the ad is closed because I am not sure how to set up the delegate. I tried to use my ad placement name but that wasn't it so I am not sure how I would set up the delegate in this case.

class DetailViewController: ISRewardedVideoDelegate {

@IBAction func ironSourceActionAd(_ sender: Any) {

    IronSource.showRewardedVideo(with:UIViewController(), placement: "DefaultRewardedVideo")
}

public func rewardedVideoHasChangedAvailability(_ available: Bool) {
}

public func rewardedVideoDidEnd() {
}

public func rewardedVideoDidStart() {
}

public func rewardedVideoDidClose() {
    text()
    print("closed")
}

public func rewardedVideoDidOpen() {
   print("Opened")
}

public func rewardedVideoDidFailToShowWithError(_ error: Error!) {
}

public func didReceiveReward(forPlacement placementInfo: ISPlacementInfo!) {
}
public func didClickRewardedVideo(_ placementInfo: ISPlacementInfo!) {
}


override func viewDidLoad() {
    super.viewDidLoad()
    IronSource.initWithAppKey("72c23e35")
  error here//  IronSource.setRewardedVideoDelegate(DetailViewController)
    ISIntegrationHelper.validateIntegration()

}
4

2 回答 2

0

可能是您没有设置 UserID。从 Ironsource 帮助文档:

确保您在初始化 ironSource SDK 之前设置了用户 ID,以便成功奖励您的用户。

这是我在 viewDidLoad 函数中的做法:

    // Ironsource set up
    IronSource.setRewardedVideoDelegate(self)

    let userID = IronSource.advertiserId() // Ironsource generates a userID automatically for each user
    IronSource.setUserId(userID)

    let appKey = "xxxxxxx" // from my Ironsource dashboard
    IronSource.initWithAppKey(appKey, adUnits: [IS_REWARDED_VIDEO])
于 2018-07-01T15:19:14.480 回答
0

本教程Step 2教授如何设置委托。看来您需要先完成Step 2,之前Step 3,和Step 4

教程,第 2 步

于 2018-05-28T08:13:23.257 回答