我在viewdidload方法中添加了以下代码
self.interstitialAd = FBInterstitialAd.init(placementID: "")
self.interstitialAd.delegate = self;
interstitialAd.load()
以及每五分钟加载广告的调用时间
Timer.scheduledTimer(timeInterval: 300.0, target: self, selector: #selector(callInterstitialAdEveryFiveMinutes), userInfo: nil, repeats: true)
@objc func callInterstitialAdEveryFiveMinutes() {
interstitialAd.load()
}
但没有每五分钟展示一次广告并给出错误 7000 您的广告已加载
提前致谢
最佳答案
根据文档,您应该首先关闭已加载的广告并请求新广告:
Do not call loadAd on the FBInterstitialAd while the ad is being shown on the screen. If you need to load another FBInterstitialAd for future use, you can do so after the user closed the current one, for example in the interstitialAdDidClose callback.
因此在这种情况下,您需要等到用户关闭第一个广告:
func interstitialAdDidClose(_ interstitialAd: FBInterstitialAd?) {
print("Interstitial had been closed")
// Consider to add code here to resume your app's flow
// .. Schedule the timer, or show another ad .. //
}
请阅读: Adding Interstitial Ad to your iOS app
或者查看这个问题InterstitialAd failed to load with error? :
The error you were receiving is basically we can't match a Facebook profile to deliver relevant ads.
关于ios - 我想在 ios 中每五分钟加载一次 facebook 插页式广告(swift),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53649266/