我在 Swift 中,每次我调用它们时,都会调用委托(delegate) func didFailWithError。我在我的所有应用程序中使用的代码与用于 Facebook 插页式广告的代码相同,除了我创建的这个新应用程序外,它工作得很好。没有广告弹出,我在控制台中收到一条消息:
DiskCookieStorage changing policy from 2 to 0, cookie file: file:///private/var/mobile/Containers/Data/Application/4E5FA239-208C-4B08-87C6-E4DB1CC3CC76/Library/Cookies/Cookies.binarycookies
这就是我在 GameViewController 中设置代码的方式:
import UIKit
import SpriteKit
let interstitialFBAD: FBInterstitialAd = FBInterstitialAd(placementID: "2320559454634478_1321860725967683")
class GameViewController: UIViewController, FBInterstitialAdDelegate {
override func viewDidLoad() {
super.viewDidLoad()
if let scene = GameScene(fileNamed:"GameScene") {
loadFBInterstitialAd()
}
}
//fbAds--------------------------------------------------------------------------------------------------------
func loadFBInterstitialAd() {
interstitialFBAD.delegate = self
interstitialFBAD.load()
print("what")
}
func interstitialAdDidLoad(_ interstitialAd: FBInterstitialAd) {
interstitialFBAD.show(fromRootViewController: self)
print("popup")
}
func interstitialAd(_ interstitialAd: FBInterstitialAd, didFailWithError error: Error) {
print("failed")
}
//fbAds--------------------------------------------------------------------------------------------------------
最佳答案
于是从
Im in Swift and every-time I call them the delegate func didFailWithError gets called. Im using the same code I use for the facebook intersitial ads in all my apps and it works perfectly except for this new app I created. No ads pop up and I get a message in my console saying:
这似乎是我的第一个解决方案不是答案,但它是如此明显我仍然需要指出:来自 Facebook docs似乎有几个步骤可以创建可以正确使用 SDK 的应用程序(即在 Facebook 中创建应用程序并使用正确的 Info.plist
键等)。
如果这不是正在发生的事情,但我想它不是,那么这仍然可能是由于应用程序未正确设置,而不是 Facebook SDK 以外的原因。
没有看到您如何在 AppDelegate
中初始化 SDK,也没有确认您尝试展示的广告缺少的不是 Info.plist
键,而是很难说这里可能有什么问题。您联系过 Facebook 支持吗?他们肯定也能在这里提供帮助。某处关闭 this page作为付费广告客户,我相信您可以找到适当的实时支持。
关于swift - 为什么我的 Facebook 插页式广告没有显示在我的应用程序中?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43421090/