iOS Verizon Ads SDK Standard Edition Documentation  1.14
Instance Methods | Class Methods | Properties | List of all members
VASNativeAdFactory Class Reference

VASNativeAdFactory is a factory class that handles loading and caching of VASNativeAd placements. More...

#import <VASNativeAdFactory.h>

Inherits NSObject.

Instance Methods

(void) - abortLoad
 Aborts any load requests that are still active.
 
(void) - destroy
 Frees the internal resources held by the factory. More...
 
(instancetype) - initWithPlacementId:adTypes:vasAds:delegate:
 Initialize a VASNativeAdFactory for creating VASNativeAd objects. More...
 
(void) - load:
 Requests a new VASNativeAd. More...
 
(nullable VASNativeAd *) - loadAdFromCache:
 Attempts to load a VASNativeAd from the cache. More...
 
(void) - loadBid:nativeAdDelegate:
 Loads the VASNativeAd for the provided bid. More...
 
(void) - loadBidWithoutAssets:nativeAdDelegate:
 Loads the VASNativeAd for the provided bid, without loading the ad's assets (images and videos). More...
 
(void) - loadWithoutAssets:
 Requests a new VASNativeAd without loading its assets (images and videos). More...
 
(void) - prefetch
 Initializes a cache replenishment request. More...
 

Class Methods

(void) + requestBidForPlacementId:adTypes:requestMetadata:vasAds:completionHandler:
 Requests a bid for the opportunity to win the VASNativeAd impression. More...
 

Properties

NSUInteger cacheReplenishmentThresholdOverride
 Gets or sets the cache replenishment threshold override for this instance of the factory, which will then be used instead of SDK configuration or the default value. More...
 
id< VASNativeAdFactoryDelegatedelegate
 The object implementing the VASNativeAdFactoryDelegate protocol, to receive ad factory event callbacks.
 
NSStringplacementId
 The placementId for the VASNativeAdFactory.
 
VASRequestMetadatarequestMetadata
 The VASRequestMetadata object that overrides global VASRequestMetadata for the VASNativeAdFactory ad requests.
 

Detailed Description

VASNativeAdFactory is a factory class that handles loading and caching of VASNativeAd placements.

It uses the VASNativeAdFactoryDelegate protocol to provide notifications about VASNativeAd creation.

Method Documentation

◆ destroy

- (void) destroy

Frees the internal resources held by the factory.

The instance cannot be used after this method is called.

◆ initWithPlacementId:adTypes:vasAds:delegate:

- (instancetype) initWithPlacementId: (NSString *)  placementId
adTypes: (NSArray< NSString * > *)  adTypes
vasAds: (VASAds *)  vasAds
delegate: (nullable id< VASNativeAdFactoryDelegate >)  delegate 

Initialize a VASNativeAdFactory for creating VASNativeAd objects.

Use this to set the placementId and listener for VASNativeAd objects that the VASNativeAdFactory will create.

Parameters
placementIdThe placementId that will be set for all VASNativeAd objects that the VASNativeAdFactory creates.
adTypesThe array of requested native types.
vasAdsThe VASAds object to use for creating a VASNativeAd.
delegateThe VASNativeAdFactoryDelegate that will receive ad factory events for the VASNativeAdFactory.
Returns
An instance of this class.

◆ load:

- (void) load: (id< VASNativeAdDelegate >)  nativeAdDelegate

Requests a new VASNativeAd.

Parameters
nativeAdDelegateThe VASNativeAdDelegate that will receive ad events for the VASNativeAd.

◆ loadAdFromCache:

- (nullable VASNativeAd *) loadAdFromCache: (id< VASNativeAdDelegate >)  nativeAdDelegate

Attempts to load a VASNativeAd from the cache.

If the cache is empty, nil is returned.

Parameters
nativeAdDelegateThe VASNativeAdDelegate that will receive ad events for the VASNativeAd.
Returns
A VASNativeAd from the cache or nil if the cache is empty.

◆ loadBid:nativeAdDelegate:

- (void) loadBid: (VASBid *)  bid
nativeAdDelegate: (id< VASNativeAdDelegate >)  nativeAdDelegate 

Loads the VASNativeAd for the provided bid.

Parameters
bidThe Bid that will be loaded.
nativeAdDelegateThe VASNativeAdDelegate that will receive ad events for the VASNativeAd.

◆ loadBidWithoutAssets:nativeAdDelegate:

- (void) loadBidWithoutAssets: (VASBid *)  bid
nativeAdDelegate: (id< VASNativeAdDelegate >)  nativeAdDelegate 

Loads the VASNativeAd for the provided bid, without loading the ad's assets (images and videos).

Parameters
bidThe Bid that will be loaded.
nativeAdDelegateThe VASNativeAdDelegate that will receive ad events for the VASNativeAd.

◆ loadWithoutAssets:

- (void) loadWithoutAssets: (id< VASNativeAdDelegate >)  nativeAdDelegate

Requests a new VASNativeAd without loading its assets (images and videos).

Parameters
nativeAdDelegateThe VASNativeAdDelegate that will receive ad events for the VASNativeAd.

◆ prefetch

- (void) prefetch

Initializes a cache replenishment request.

Note that if a request is already in progress or the cache is not below the replenishment threshold, no request will be made.

◆ requestBidForPlacementId:adTypes:requestMetadata:vasAds:completionHandler:

+ (void) requestBidForPlacementId: (NSString *)  placementId
adTypes: (NSArray< NSString * > *)  adTypes
requestMetadata: (nullable VASRequestMetadata *)  requestMetadata
vasAds: (VASAds *)  vasAds
completionHandler: (VASBidRequestCompletionHandler)  handler 

Requests a bid for the opportunity to win the VASNativeAd impression.

Parameters
placementIdThe placementId that will be set for all VASNativeAds that the VASNativeAdFactory creates.
adTypesThe array of requested native types.
requestMetadataThe VASRequestMetadata to use for ad requests.
vasAdsThe VASAds instance for this object to use.
handlerThe completion handler that will receive the bid request result.

Property Documentation

◆ cacheReplenishmentThresholdOverride

- (NSUInteger) cacheReplenishmentThresholdOverride
readwriteatomic

Gets or sets the cache replenishment threshold override for this instance of the factory, which will then be used instead of SDK configuration or the default value.

If the resulting cache size after an ad is loaded from the cache is less than or equal to this value the factory will attempt to replenish the cache. Must be a non-negative integer. Max value is 30.