【问题标题】:Facebook Audience Network interstitials not showingFacebook Audience Network 插页式广告未显示
【发布时间】:2015-09-29 17:18:43
【问题描述】:

我正在开发使用 Sprite Kit 构建的应用程序。我尝试添加加载广告的功能,但未加载广告。我不确定这是否是因为我的应用程序还没有上线,我需要打开某种“沙盒”,或者我是否做错了什么。广告的显示点从SKScene 调用,广告显示函数和方法(加载、显示以及委托)在父UIViewController 中。

以下是将应用程序从SKScene 定向到ViewController 的代码:

GameViewController *vc = (GameViewController*)self.view.window.rootViewController;
[vc loadInterstitial];

GameViewControllerSKScene 的父视图控制器。下面是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


【解决方案1】:

当我在 loadInterstitial 方法中声明 FBInterstitialAd 实例时,我遇到了未显示插页式广告的问题。将声明移到方法之外后,它神奇地起作用了。在此处查看 Facebook Audience 网络示例:https://github.com/fbsamples/audience-network-support

【讨论】:

    【解决方案2】:

    FBInterstitialAdDelegate 添加到您的GameViewController 界面。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-15
      • 1970-01-01
      • 1970-01-01
      • 2020-02-26
      相关资源
      最近更新 更多