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:
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
This is how I setup the code in my 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--------------------------------------------------------------------------------------------------------
So from
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:
This seems like my first solution is not the answer, but it's so obvious I need to point it out nonetheless: from the Facebook docs it seems like there's a couple steps to creating an app that can use the SDK properly (namely creating an app in Facebook and using the proper Info.plist
keys, etc).
If that's not what is happening, though, which I imagine it's not, then this could still be due to the application not being properly set up but for a reason other than Facebook SDK.
Without seeing how you are initializing the SDK in your AppDelegate
and without confirmation it's not Info.plist
keys that are missing for the ads you are attempting to show, it's hard to say what the issue could be here. Have you contacted Facebook support? They'd definitely be able to help here as well. Somewhere off this page I'm sure you can find proper live support as a paying ads customer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With