How to test Facebook Audience Network ads over TestFlight?

烂漫一生 提交于 2019-12-05 10:39:05

问题


I am trying to integrate Audience Network to my app. Ads work correctly on simulator and device when I deploy over XCode.

I want to distribute the build over TestFlight to be sure it will work in release mode. When I try to directly deploy from XCode to my device in release mode, Facebook returns "No fill" for the Ads. Ads do not show up on TestFlight builds either.

Have any ideas about showing ads for devices in TestFlight builds?


回答1:


There could be two main reasons for this. Firstly, the user or testers could not be signed-in to the native Facebook app on the device. This could then result in Error 1001 - No Fill Rate.

1001 - No Fill

This is a common error seen while testing, and relates to a "No Fill" response; the most common reason for this is the user is not logged in to the Native Facebook App on a Test Device.

Server Response SDK Documentation Code=1001 “No Fill” Error 1001 - No Fill. Maybe due to one or more of the following:

  • User not logged into the Native Facebook App on Mobile Device
  • Limit Ad Tracking turned on (iOS)
  • No Ad Inventory for current user
  • Your testing device must have the native Facebook application installed.
  • Your application should attempt to make another request after 30 seconds.

This is what the documentation tells you for the 1001 error.

Secondly, you may still be in the debug mode and therefore you're not seeing ads in the release mode. To fix this error, download the newest provisioning profiles from the Apple Developer Center and toggle the Facebook App as released. You can do That by logging into the Facebook Developer console and selecting your app. Then on the left-hand side you should have this column, where you select STATUS & REVIEW. Then, toggle the "Do you want to make this app public?" toggle to YES. This will make your app available to anyone, meaning that the ads will pop up with all your testers.

My two cents from my experience here would be that you didn't make you app public or didn't have the users added as beta testers. Therefore facebook was unable to deliver any ads throwing the 1001 error. This should be a quick fix by making the app public and having your testers sign in through the facebook app. I had a similar problem with another part of the Facebook SDK, which got fixed by the public release.

Hope that helps, Julian




回答2:


If you have your ads in many places you can put this code in the AppDelegate

Swift 3

import FBAudienceNetwork

private func facebookAdsControl() {
    #if RELEASE
         self.clearTestDevicesForFacebookAds()
    #else
         self.addTestDevicesForFacebookAds()
    #endif
}

///remove for live mode
private func addTestDevicesForFacebookAds(){
    let key = FBAdSettings.testDeviceHash()
    FBAdSettings.setLogLevel(FBAdLogLevel.Log)
    FBAdSettings.addTestDevice(key)
}

///add for live mode
private func clearTestDevicesForFacebookAds() {
    FBAdSettings.clearTestDevices()
}

This code will make sure that your test ads show on testflight or the simulator/device and also will make sure when you release to the app store that your ads will be shown as LIVE ads and the test devices will be cleared.

call the: facebookAdsControl() in the didFinishLaunchingWithOptions

You can also call this code in the code where you have the ads but make sure you call it before adView.load()

In order to use the macro you have to add the flags to your Swift Flags in the Build Settings

I hope this helps someone as the Facebook Docs are not very clear as I have found out.




回答3:


I have still faced the same issue after applying the above solutions. I have resolved by adding deviceHashId:-

FBNativeAd *nativeAd;
static NSString *adPlacementId = @"xxxxxxxxx";

- (void)showNativeAd:(UIViewController *)vc
{
  nativeAd = [[FBNativeAd alloc] initWithPlacementID:adPlacementId];
  nativeAd.delegate = self;

  NSLog(@"isTestMode1: %d",[FBAdSettings isTestMode]);
  NSString *testDeviceKey = [FBAdSettings testDeviceHash];
  if (testDeviceKey) {
    [FBAdSettings addTestDevice:testDeviceKey];
  }
  [nativeAd loadAd];
}

I have some different problem if anyone have any point please reply this stack overflow link




回答4:


Error 1001 - No Fill Rate.

If you want to test real ads, try these steps:

  1. Logged in Facebook app
  2. Open Safari
  3. Find on google "macbook air buy", open any shop, add macbook to cart
  4. Open Facebook app, pull-to-refresh Facebook history
  5. Open your app
  6. Repeat steps 2-5 with different search terms until ads is showed up in your app

For our test devices it works almost every time.



来源:https://stackoverflow.com/questions/33909430/how-to-test-facebook-audience-network-ads-over-testflight

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!