iosswiftheyzap

HeyZap (SDK 10.2.1) IOS Delegate function not called


I'm integrating the SDK HeyZap on an iOS application.

I can fetch() and show() an IncentivizedAd.

But I can't use the callback delegate functions.

The three ways don't work for me (Notification, completion on (HZIncentivizedAd.ShowWithOptions), and with HZAdsDelegate, HZIncentivizedAdDelegate declared on my class.

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")
 }

}

Did I forget something to initialize ? I use Xcode 7.3.1 with Swift 2.3

Thanks for helping me


Solution

  • Heyzap 10.2.1 indeed had an issue with callbacks. We pulled it off our site quickly after it was released, and will have 10.2.2. out today to replace it. Sorry about the inconvenience!

    source: I work at Heyzap