FBNativeAd Class Reference
Inherits from | NSObject |
Declared in | FBNativeAd.h |
Overview
@class FBNativeAd
@abstract The FBNativeAd represents ad metadata to allow you to construct custom ad views. See the NativeAdSample in the sample apps section of the Audience Network framework.
Tasks
-
placementID
property -
FB_DEPRECATED
property -
title
property -
subtitle
property -
socialContext
property -
callToAction
property -
icon
property -
coverImage
property -
body
property -
mediaCachePolicy
property -
delegate
property -
– initWithPlacementID:
-
– registerViewForInteraction:withViewController:
-
– registerViewForInteraction:withViewController:withClickableViews:
-
– unregisterView
-
– loadAd
-
adValid
property
Properties
FB_DEPRECATED
Typed access to the ad star rating. See FBAdStarRating
for details.
@property (nonatomic, assign, readonly) struct FBAdStarRating starRating FB_DEPRECATED
Declared In
FBNativeAd.h
adValid
@property
@property (nonatomic, getter=isAdValid, readonly) BOOL adValid
Discussion
@abstract Call isAdValid to check whether native ad is valid & internal consistent prior rendering using its properties. If rendering is done as part of the loadAd callback, it is guarantee to be consistent
Declared In
FBNativeAd.h
body
Typed access to the body text, usually a longer description of the ad.
@property (nonatomic, copy, readonly, nullable) NSString *body
Declared In
FBNativeAd.h
callToAction
Typed access to the call to action phrase of the ad, for example “Install Now”.
@property (nonatomic, copy, readonly, nullable) NSString *callToAction
Declared In
FBNativeAd.h
coverImage
Typed access to the ad cover image creative. See FBAdImage
for details.
@property (nonatomic, strong, readonly, nullable) FBAdImage *coverImage
Declared In
FBNativeAd.h
delegate
the delegate
@property (nonatomic, weak, nullable) id<FBNativeAdDelegate> delegate
Declared In
FBNativeAd.h
icon
Typed access to the ad icon. See FBAdImage
for details.
@property (nonatomic, strong, readonly, nullable) FBAdImage *icon
Declared In
FBNativeAd.h
mediaCachePolicy
Set the native ad caching policy. This controls which media (images, video, etc) from the native ad are cached before the native ad calls nativeAdLoaded on its delegate. The default is to not block on caching. Ensure that media is loaded through FBMediaView or through [FBAdImage loadImageAsyncWithBlock:] to take full advantage of caching.
@property (nonatomic, assign) FBNativeAdsCachePolicy mediaCachePolicy
Declared In
FBNativeAd.h
placementID
Typed access to the id of the ad placement.
@property (nonatomic, copy, readonly, nonnull) NSString *placementID
Declared In
FBNativeAd.h
socialContext
Typed access to the ad social context, for example “Over half a million users”.
@property (nonatomic, copy, readonly, nullable) NSString *socialContext
Declared In
FBNativeAd.h
Instance Methods
initWithPlacementID:
@method
- (instancetype)initWithPlacementID:(NSString *)placementID
Parameters
- placementID
The id of the ad placement. You can create your placement id from Facebook developers page.
Discussion
@abstract This is a method to initialize a FBNativeAd object matching the given placement id.
Declared In
FBNativeAd.h
loadAd
@method
- (void)loadAd
Discussion
@abstract Begins loading the FBNativeAd content.
You can implement nativeAdDidLoad:
and nativeAd:didFailWithError:
methods
of FBNativeAdDelegate
if you would like to be notified as loading succeeds or fails.
Declared In
FBNativeAd.h
registerViewForInteraction:withViewController:
@method
- (void)registerViewForInteraction:(UIView *)view withViewController:(nullable UIViewController *)viewController
Parameters
- view
The UIView you created to render all the native ads data elements.
- viewController
The UIViewController that will be used to present SKStoreProductViewController (iTunes Store product information) or the in-app browser. If nil is passed, the top view controller currently shown will be used.
Discussion
@abstract This is a method to associate a FBNativeAd with the UIView you will use to display the native ads.
The whole area of the UIView will be clickable.
Declared In
FBNativeAd.h
registerViewForInteraction:withViewController:withClickableViews:
@method
- (void)registerViewForInteraction:(UIView *)view withViewController:(nullable UIViewController *)viewController withClickableViews:(FB_NSArrayOf ( UIView *) *)clickableViews
Parameters
- view
The UIView you created to render all the native ads data elements.
- viewController
The UIViewController that will be used to present SKStoreProductViewController (iTunes Store product information). If nil is passed, the top view controller currently shown will be used.
- clickableViews
An array of UIView you created to render the native ads data element, e.g. CallToAction button, Icon image, which you want to specify as clickable.
Discussion
@abstract This is a method to associate FBNativeAd with the UIView you will use to display the native ads and set clickable areas.
Declared In
FBNativeAd.h