我在横幅广告单元上使用获取需求时遇到问题。状态代码总是在本地 iOS 模拟器上返回“预投标服务器未返回投标”测试。
我通过更改一些配置设置并得到其他状态代码消息而搞砸了。我只想成功获得健全性检查的投标,并确保我目前没有做错任何事情。
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)
}
}