Swift Show Meta Audience Network Native Ad

216 Views Asked by At

I am using Facebook's Audience Network SDK to show a native ad in my app. The question is:

Where should we get the Bid Payload String to populate the field?

Code:

private func loadFacebookAd() {

    // Remove the previous view before loading a new one
    adView?.removeFromSuperview()

    // Create a native ad request with a unique placement ID (generate your own on the Facebook app settings).
    // Use different ID for each ad placement in your app.
    let ad = FBNativeAd(placementID: "PLACEMENT_ID")

    // Set the delegate of the ad object before loading the ad
    ad.delegate = self

    // TODO: - Initiate a request to load an ad. What goes in the bid payload field?
    ad.loadAd(withBidPayload: <#T##String#>)
}
2

There are 2 best solutions below

0
batman On BEST ANSWER

According to this link you get the bid payload by making a request to an auction server, presumably used for mediation. The response contains the bid payload which can then be used to load an ad.

self.payload = json[@"bid_payload"];

The documentation in my opinion seems a little outdated though.

1
Mcrich On

It looks like you can just use the admob code for both and setup mediation at this url: https://apps.admob.com/v2/mediation/waterfall.

enter image description here