为IronSource移动广告设置代理

时间:2018-05-28 08:06:00

标签: ios swift delegates ironsource

我正在关注此tutorial但是我无法弄清楚如何设置委托。我已完成其他所有操作并且广告正在显示,但广告关闭后我无法运行任何代码,因为我不确定如何设置代理。我尝试使用我的广告展示位置名称,但不是这样,所以我不确定在这种情况下如何设置代理。

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()

}

2 个答案:

答案 0 :(得分:0)

The tutorial's Step 2教授如何设置委托。您似乎需要先在discordant_sums(df[,seq(1,ncol(df),2)]!=,df[,seq(2,ncol(df),2)]) Step 2之前完成Step 3

Tutorial, step 2

答案 1 :(得分: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])