iOS SDK Version

FBNativeAdsManager

@interfaceFBNativeAdsManager:NSObject
This class provides a mechanism to fetch a set of ads and then use them within your application. The recommended usage is to call nextNativeAd: at the moment when you are about to render an ad. The native ads manager supports giving out as many ads as needed by cloning over the set of ads it got back from the server which can be useful for feed scenarios.
  • The delegate

    Declaration

    Objective-C
    @property(nonatomic,weak,readwrite,nullable)id<FBNativeAdsManagerDelegate>delegate;
    Swift
    weakvardelegate:FBNativeAdsManagerDelegate?{getset}
  • Set the native ads manager caching policy. This controls which media from the native ads are cached before the native ads manager calls nativeAdsLoaded on its delegate. The default is to not block on caching.

    Declaration

    Objective-C
    @property(nonatomic,assign,unsafe_unretained,readwrite)FBNativeAdsCachePolicymediaCachePolicy;
    Swift
    varmediaCachePolicy:FBNativeAdsCachePolicy{getset}
  • Number of unique native ads that can be accessed through nextNativeAd:. This is not valid until the nativeAdsLoaded: message has been sent.

    Declaration

    Objective-C
    @property(nonatomic,assign,unsafe_unretained,readonly)NSUIntegeruniqueNativeAdCount;
    Swift
    varuniqueNativeAdCount:UInt{get}
  • Returns YES after nativeAdsLoaded: message has been sent.

    Declaration

    Objective-C
    @property(nonatomic,assign,unsafe_unretained,readonly,getter=isValid)BOOLvalid;
    Swift
    varisValid:Bool{get}
  • FBAdExtraHint to provide extra info

    Declaration

    Objective-C
    @property(nonatomic,strong,readwrite,nullable)FBAdExtraHint*extraHint;
    Swift
    varextraHint:FBAdExtraHint?{getset}
  • Initialize the native ads manager.

    Declaration

    Objective-C
    -(nonnullinstancetype)initWithPlacementID:(nonnullNSString*)placementIDforNumAdsRequested:(NSUInteger)numAdsRequested;
    Swift
    init(placementID:String,forNumAdsRequestednumAdsRequested:UInt)

    Parameters

  • The method that kicks off the loading of ads. It may be called again in the future to refresh the ads manually.

    Declaration

    Objective-C
    -(void)loadAds;
    Swift
    funcloadAds()
  • By default the native ads manager will refresh its ads periodically. This does not mean that any ads which are shown in the application’s UI will be refreshed but simply that calling nextNativeAd: may return different ads at different times. This method disables that functionality.

    Declaration

    Objective-C
    -(void)disableAutoRefresh;
    Swift
    funcdisableAutoRefresh()
  • Retrieve the next native ad to be used from the batch. It is highly recommended that the caller wait until immediately before rendering the ad content to call this method to ensure the best ad for the given context is used. If more than uniqueNativeAdCount ads are requested cloned ads will be returned. Periodically the native ads manager will refresh and new ads will be returned.

    Declaration

    Objective-C
    @property(nonatomic,strong,readonly,nullable)FBNativeAd*nextNativeAd;
    Swift
    varnextNativeAd:FBNativeAd?{get}

    Return Value

    A FBNativeAd which is loaded and ready to be used.