Page tree


Inherits from:NSObject
Declared in:

PMNativeAd.h

PMNativeAd.m

Overview


The PMNativeAd class used to request Native ads from PubMatic.

Tasks


– execute:

  delegate property

  adAssetResponseArray property

  useInternalBrowser  property

– trackViewForInteractions:withViewController:

– loadInImageView:withURL:

– destroy

Properties


adAssetResponseArray

Contains an array of PMNativeAd assets returned from PubMatic server.

@property (nonatomic, readonly) NSArray<PMNativeAssetResponse*> *adAssetResponseArray

Discussion

All requested native ad assets fetched from PubMatic servers are available in adAssetResponseArray. It may contain objects of PMNativeDataAssetResponse , PMNativeImageAssetResponse , PMNativeTitleAssetResponse based on the asset type requested.

Declared In

PMNativeAd.h

delegate

(abstract) Sets the PMNativeAdDelegate receiver for the PMNativeAd .

@property (nonatomic, weak) id<PMNativeAdDelegate> delegate
"alert">Warnings:
  1. Observe proper reference management when using delegates.
  2. Always set the delegate to nil before setting the PMNativeAd object reference to nil.

Declared In

PMNativeAd.h


useInternalBrowser

Set to YES to enable the internal browser to open ad content (defaults to NO).

@property (nonatomic, assign) BOOL useInternalBrowser

Declared In

PMNativeAd.h

Instance Methods


destroy

Method will be used to destroy instance of native ad and hence free resources.

- (void)destroy


Declared In

PMNativeAd.h

loadRequest:

Issues an request to fetch new native ad.

- (void)execute:(PMBaseAdRequest *)adRequest

Parameters

adRequest
Native Ad request.

Declared In

PMNativeAd.h

loadInImageView:withURL:

Method will asyncronously download and hence render image in imageView. This method can be used for rendering icon and cover image.

- (void)loadInImageView:(UIImageView *)imageView withURL:(NSString *)urlString

Parameters

imageView
Image View where image is to be rendered.
urlString
URL of image which is to be rendered.

Declared In

PMNativeAd.h

trackViewForInteractions:withViewController:

Method to be called once native ad is sucessfully rendered for sending sucess metric url and hence handling user clicks.

- (void)trackViewForInteractions:(UIView *)view withViewController:(UIViewController *)viewController

Parameters

view
Native Ad View where all native ad components are rendered.
viewController
Viewcontroller on which native ad is placed.

Declared In

PMNativeAd.h


⇧ Top