How to test Facebook Audience Network ads over TestFlight?

前端 未结 4 1167
猫巷女王i
猫巷女王i 2021-02-12 20: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

相关标签:
4条回答
  • 2021-02-12 20:42

    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.

    0 讨论(0)
  • 2021-02-12 20:56

    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

    0 讨论(0)
  • 2021-02-12 20:57

    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.

    0 讨论(0)
  • 2021-02-12 20:58

    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

    0 讨论(0)
提交回复
热议问题