0

我正在将 SDK HeyZap 集成到 iOS 应用程序上。

我可以 fetch() 和 show() 一个 IncentivizedAd。

但我不能使用回调委托函数。

这三种方法对我不起作用(通知、完成(HZIncentivizedAd.ShowWithOptions),以及在我的班级上声明的 HZAdsDelegate、HZIncentivizedAdDelegate。

class GridLigueController: MyViewController, UITableViewDataSource, HZAdsDelegate, HZIncentivizedAdDelegate {

 func didShowAdNotificationHandler() {
    print("didShowAdNotificationHandler")
 }

// Configure with NSNotification Listener
// function called on viewDidLoad
 func configureRewardVideo() {

    HZIncentivizedAd.setDelegate(self)
    NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(didShowAdNotificationHandler), name:HZMediationDidShowAdNotification, object:nil)
    if adRequestInProgress == false && HZIncentivizedAd.isAvailable() == false {
        HZIncentivizedAd.fetch()
        adRequestInProgress = true
        print("[Debug] - adRequestInProgress...")
    } else {
        print("[Debug] - Reward video not ready : \(adRequestInProgress)")
    }

// Completion on showWithOptions
 func completion(success: Bool, error: NSError!) -> Void {
    if success {
        print("success showing an ad")
    } else {
        print("error showing an ad; error was %@",error)
    }
 }

 func showAd() {
  if  HZIncentivizedAd.isAvailable()  {
        let options = HZShowOptions()
        options.viewController = self
        options.completion = self.completion
        HZIncentivizedAd.showWithOptions(options)
        print("[Debug] - HZIncentivizedAd video is ready, should be shown")
  } else { // show an alert }
 }

// Normal Delegate function
 func didReceiveAdWithTag(tag: String!) {
    print("didReceiveAdWithTag")
 }

 func didShowAdWithTag(tag: String!) {
    print("didShowAdWithTag")
 }

 func didFailToCompleteAdWithTag(tag: String!) {
    print("didFailToCompleteAdWithTag")
 }

 func didCompleteAdWithTag(tag: String!) {
    print("didCompleteAdWithTag")
 }

}

我忘记了要初始化的东西吗?我使用 Xcode 7.3.1 和 Swift 2.3

谢谢你帮助我

4

2 回答 2

1

Heyzap 10.2.1 确实存在回调问题。我们在它发布后迅速将其从我们的网站上撤下,并将拥有 10.2.2。今天出去换了。给您带来的不便深表歉意!

资料来源:我在 Heyzap 工作

于 2016-12-08T18:24:56.610 回答
0

HeyZap 给我发了一条消息,我使用的 SDK 版本(10.2.1)在回调上有问题。

现在效果很好。

于 2016-12-08T11:48:29.903 回答