我正在开发我的应用程序,该应用程序是使用 Sprite Kit 构建的。我尝试添加加载广告的功能,但未加载广告。我不确定这是否是因为我的应用程序还没有上线,我需要打开某种“沙盒”,或者我是否做错了什么。广告的展示点是从 中调用的SKScene
,广告展示的函数和方法(加载、展示以及委托)在父级中UIViewController
。
以下是将应用程序定向到ViewController
from 的代码SKScene
:
GameViewController *vc = (GameViewController*)self.view.window.rootViewController;
[vc loadInterstitial];
GameViewController
是SKScene
. 以下是包含在中的代码GameViewController
:
- (void)loadInterstitial
{
self.interstitialAd =
[[FBInterstitialAd alloc] initWithPlacementID:@"Placement ID"];
self.interstitialAd.delegate = self;
[self.interstitialAd loadAd];
}
- (void)interstitialAdDidLoad:(FBInterstitialAd *)interstitialAd
{
NSLog(@"Interstitial ad is loaded and ready to be displayed");
// You can now display the full screen ad using this code:
[interstitialAd showAdFromRootViewController:self];
}
- (void)interstitialAd:(FBInterstitialAd *)interstitialAd
didFailWithError:(NSError *)error
{
NSLog(@"Interstitial ad is failed to load with error: %@", error);
}
该方法interstitialAdDidLoad
没有被调用,我也没有收到任何错误。