【发布时间】:2015-09-29 17:18:43
【问题描述】:
我正在开发使用 Sprite Kit 构建的应用程序。我尝试添加加载广告的功能,但未加载广告。我不确定这是否是因为我的应用程序还没有上线,我需要打开某种“沙盒”,或者我是否做错了什么。广告的显示点从SKScene 调用,广告显示函数和方法(加载、显示以及委托)在父UIViewController 中。
以下是将应用程序从SKScene 定向到ViewController 的代码:
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 没有被调用,我也没有收到任何错误。
【问题讨论】:
-
您好,您找到解决此问题的方法了吗?
标签: objective-c facebook-sdk-4.x facebook-audience-network