YASNativeAdDelegate
Objective-C
@protocol YASNativeAdDelegate <NSObject>
Swift
protocol YASNativeAdDelegate : NSObjectProtocol
Protocol for receiving notifications from the YASNativeAd. These notifications will be called on an arbitrary queue.
-
Called when the YASNativeAd has been successfully fetched and its content loaded in preparation for display. Note that this method is only called when ad fetching and loading is performed via the asynchronous -[YASNativeAd loadWithPlacementConfig:] method.
Declaration
Objective-C
- (void)nativeAdDidLoad:(nonnull YASNativeAd *)nativeAd;
Swift
func nativeAdDidLoad(_ nativeAd: YASNativeAd)
Parameters
nativeAd
The YASNativeAd that was loaded.
-
Called when an error occurs during the YASNativeAd fetch and load lifecycle. A YASErrorInfo object provides detail about the error. Note that this method is only called when ad fetching and loading is performed via the asynchronous -[YASNativeAd loadWithPlacementConfig:] method.
Declaration
Objective-C
- (void)nativeAdLoadDidFail:(nonnull YASNativeAd *)nativeAd withError:(nonnull YASErrorInfo *)errorInfo;
Swift
func nativeAdLoadDidFail(_ nativeAd: YASNativeAd, withError errorInfo: YASErrorInfo)
Parameters
nativeAd
The YASNativeAd that experienced the error.
errorInfo
The YASErrorInfo that describes the error that occurred.
-
Called when an error occurs during the YASNativeAd lifecycle. A YASErrorInfo object provides detail about the error.
Declaration
Objective-C
- (void)nativeAdDidFail:(nonnull YASNativeAd *)nativeAd withError:(nonnull YASErrorInfo *)errorInfo;
Swift
func nativeAdDidFail(_ nativeAd: YASNativeAd, withError errorInfo: YASErrorInfo)
Parameters
nativeAd
The YASNativeAd that experienced the error.
errorInfo
The YASErrorInfo that describes the error that occurred.
-
Called when the YASNativeAd has been clicked.
Declaration
Objective-C
- (void)nativeAdClicked:(nonnull YASNativeAd *)nativeAd withComponent:(nonnull id<YASNativeComponent>)component;
Swift
func nativeAdClicked(_ nativeAd: YASNativeAd, with component: YASNativeComponent)
Parameters
nativeAd
The YASNativeAd associated with the click.
component
The YASComponent that was clicked.
-
Called when the YASNativeAd causes the user to leave the application. For example, tapping a YASNativeAd may launch an external browser.
Declaration
Objective-C
- (void)nativeAdDidLeaveApplication:(nonnull YASNativeAd *)nativeAd;
Swift
func nativeAdDidLeaveApplication(_ nativeAd: YASNativeAd)
Parameters
nativeAd
The YASNativeAd that caused the application exit.
-
Called prior to presenting another view controller to use for displaying the fullscreen experiences.
Declaration
Objective-C
- (nullable UIViewController *)nativeAdPresentingViewController;
Swift
func nativeAdPresentingViewController() -> UIViewController?
Return Value
a UIViewController capable of presenting another view controller to use for displaying the fullscreen experiences. Returning nil will result in no fullscreen experience being displayed and an error returned to the ad.
-
This callback is used to surface additional events to the publisher from the SDK.
Declaration
Objective-C
- (void)nativeAd:(nonnull YASNativeAd *)nativeAd event:(nonnull NSString *)eventId source:(nonnull NSString *)source arguments:(nonnull NSDictionary<NSString *, id> *)arguments;
Swift
func nativeAd(_ nativeAd: YASNativeAd, event eventId: String, source: String, arguments: [String : Any])
Parameters
nativeAd
The YASNativeAd that is relaying the event.
eventId
The event identifier.
source
The identifier of the event source.
arguments
A dictionary of key/value pairs of arguments related to the event.