How to test Facebook Audience Network ads over TestFlight?
Asked Answered
T

3

15

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?

Tijuana answered 25/11, 2015 at 5:58 Comment(5)
What are the differencies between your 2 configurations (debug/release)? Maybe you activated a debug mode (ie list of debug devices) for Facebook Audience Network only for your debug configuration? Has your Facebook apps been validated?Derwon
The configurations are the same. Furthermore, when I ran the app in Release scheme, I see the ads both on the simulator and on the device.Tijuana
I though you did not have ads on devices in release mode : " When I try to directly deploy from XCode to my device in release mode, Facebook returns "No fill" for the Ads. "Derwon
@Tijuana Did you get the solution of having ads on testflight build? I tried but I didnot got ads on device for testflight build however I had ads when I ran the code through xcode.Slaw
@iYoung, the ads just won't show if I distributing the code with testflight. The solution for me was distributing with Crashlytics.Tijuana
F
6

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. screenshot 1 Then, toggle the "Do you want to make this app public?" toggle to YES. 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

Fourgon answered 5/12, 2015 at 20:0 Comment(0)
M
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.

Maus answered 13/7, 2017 at 13:46 Comment(1)
More info adding Swift Flags: kitefaster.com/2016/01/23/…Kneepad
A
0

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

Actor answered 12/12, 2016 at 10:41 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.