Migrating iOS prebid mobile from 0.53 to 1.82

78 views Asked by At

I am having an issue when using the fetch demand on a banner ad unit. The status code always returns "Prebid Server did not return bids" testing on a iOS simulator locally.

I've messed around by changing some config settings and got other status code messages. I just want to successfully get a bid for sanity check and ensure I'm currently doing nothing wrong.

    func fetchBannerBid() {
        guard let adView = self.adView, !isInterstitial else {
            return
        }
        let chosenAdUnit : BannerAdUnit
        if adUnitId == Constant.SEAppNexusBannerAdUnitID {
            chosenAdUnit = BannerAdUnit(configId: Constant.SEAppNexusBannerConfigID, size: CGSize(width: 320, height: 50))
            chosenAdUnit.pbAdSlot = Constant.SEAppNexusBannerAdUnitID
        }
        
        else {
            chosenAdUnit = BannerAdUnit(configId: Constant.SEAppNexusMediumConfigID, size: CGSize(width: 320, height: 250))
            chosenAdUnit.pbAdSlot = Constant.SEAppNexusMediumRectAdUnitID
        }
        
        // Do any additional setup after loading the view, typically from a nib.
        chosenAdUnit.fetchDemand { [weak self] (resultCode: ResultCode, targetingDict: [String : String]?) in
            guard let `self` = self else { return }
            self.fetchStartDate = Date()
            print("Testing appnexus: result code = \(resultCode.name())")
            if let fetchStartDate = self.fetchStartDate {
                let loadTime = String(Date().timeIntervalSince(fetchStartDate))
                self.delegate?.bidderDidFinish(name: self.name, keywordsToAdd: [], parsedBid: nil, loadTime: loadTime)
            }
        }
1

There are 1 answers

0
yoAlex5 On

you can use

//pass AdServer object which will be modified internally
adUnit.fetchDemand(adObject:)

//you are responsible for setting targetingDict into AdServer object
adUnit.fetchDemand(resultCode: targetingDict:)

In any case you should have at least some result from PrebidServer to pass it into AdServer object