Native ads are ad assets that are presented to users via UI components that are native to the platform. They're shown using the same classes you already use in your storyboards, and can be formatted to match your app's visual design. When a native ad loads, your app receives an ad object that contains its assets, and the app (rather than the SDK) is then responsible for displaying them. This differs from other ad formats, which don't allow you to customize the appearance of the ad.
This guide will show you how to use the Adx3 Ads SDK to implement native ads in an iOS app.
When building and testing your apps, make sure you use test ads rather than live, production ads. Failure to do so can lead to the suspension of your account. The easiest way to load test ads is to use our dedicated test ad unit ID for all native advanced ads on iOS:
63a5739a75da4
It's been specially configured to return test ads for every request, and you're free to use it in your own apps while coding, testing, and debugging. Just make sure you replace it with your own ad unit ID before publishing your app.
Implementation
Load an ad
Create an Adx3NativeAdView
Register for callbacks
Display the ad
Load an ad
Native ads are loaded via Adx3NativeAd objects, Which send messages to their delegates according to the Adx3NativeAdViewDelegate protocol.
The following code demonstrates how to initialize an Adx3NativeAd:
importUIKitclassViewController:UIViewController {let nativeAd =Adx3NativeAd()overridefuncviewDidLoad() { super.viewDidLoad()// Do any additional setup after loading the view. }funcloadNativeAd() { nativeAd.load(withPlacementID:"Your Placement ID", userId:"", delegate: self) }}
Before you can create Adx3NativeAdView, you need to create a Xib file, Inherited from Adx3NativeAdView. The following code demonstrates how to create an Adx3NativeAdView:
You should rely on the Adx3RewardDelegate (optional) to handle display events and request events. The following code shows how to implement the protocol: