MPNativeAdRequest

@interface MPNativeAdRequest : NSObject

The MPNativeAdRequest class is used to manage individual requests to the MoPub ad server for native ads. This class is meant for one-off requests for which you intend to manually process the native ad response. If you are using MPTableViewAdPlacer or MPCollectionViewAdPlacer to display ads, there should be no need for you to use this class.

Public Properties

Targeting Information

MPNativeAdRequestTargeting/targeting

  • Description: An object representing targeting parameters that can be passed to the MoPub ad server to serve more relevant advertising.

  • Declaration:

    @property (readwrite, strong, nonatomic) MPNativeAdRequestTargeting *targeting;
    
  • Parameters: None.

Public Methods

Initializing and Starting an Ad Request

+/requestWithAdUnitIdentifier:rendererConfigurations:

  • Description: Initializes a request object. Returns an MPNativeAdRequest object.

  • Declaration:

    + (MPNativeAdRequest *)requestWithAdUnitIdentifier:(NSString *)identifier
                              rendererConfigurations:
                                  (NSArray *)rendererConfigurations;
    
  • Parameters:

    • identifier: The ad unit identifier for this request. An ad unit is a defined placement in your application set aside for advertising. Ad unit IDs are created on the MoPub website.

    • rendererConfigurations: An array of MPNativeAdRendererConfiguration objects that control how the native ad is rendered.

-/startWithCompletionHandler:

  • Description: Executes a request to the MoPub ad server.

  • Declaration:

    - (void)startWithCompletionHandler:(MPNativeAdRequestHandler)handler;
    
  • Parameters:

    • handler: A block to execute when the request finishes. The block includes as parameters the request itself and either a valid MPNativeAd or an NSError object indicating failure.

Last updated February 27, 2020

TWITTER, MOPUB, and the Bird logo are trademarks of Twitter, Inc. or its affiliates. All third party logos and trademarks included are the property of their respective owners.

© 2020 MoPub (a division of Twitter, Inc.)