FBNativeAd
A more recent version of this class is available. Check out the latest version.

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.

Inherits from:NSObject
Declared in:FBNativeAd.h
Properties
adValid

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

@property (nonatomic, getter=isAdValid, readonly) BOOL adValid;
Declared In: FBNativeAd.h
body

Typed access to the body text, usually a longer description of the ad.

@property (nonatomic, copy, readonly) 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) NSString *callToAction;
Declared In: FBNativeAd.h
coverImage

Typed access to the ad cover image creative. See FBAdImage for details.

@property (nonatomic, strong, readonly) FBAdImage *coverImage;
Declared In: FBNativeAd.h
delegate

The delegate

@property (nonatomic, weak) id<FBNativeAdDelegate> delegate;
Declared In: FBNativeAd.h
icon

Typed access to the ad icon. See FBAdImage for details.

@property (nonatomic, strong, readonly) FBAdImage *icon;
Declared In: FBNativeAd.h
mediaCachePolicy

Set the native ad caching policy. This controls which media from the native ad us cached before the native ad calls nativeAdLoaded on its delegate. The default is to cache nothing.

@property (nonatomic, assign) FBNativeAdsCachePolicy mediaCachePolicy;
Declared In: FBNativeAd.h
placementID

Typed access to the id of the ad placement.

@property (nonatomic, copy, readonly) 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) NSString *socialContext;
Declared In: FBNativeAd.h
starRating

Typed access to the ad star rating. See FBAdStarRating for details.

@property (nonatomic, assign, readonly) struct FBAdStarRating starRating;
Declared In: FBNativeAd.h
subtitle

Typed access to the ad subtitle.

@property (nonatomic, copy, readonly) NSString *subtitle;
Declared In: FBNativeAd.h
title

Typed access to the ad title.

@property (nonatomic, copy, readonly) NSString *title;
Declared In: FBNativeAd.h
Instance Methods
initWithPlacementID:

This is a method to initialize a FBNativeAd object matching the given placement id.

ParameterDescription
placementID

The id of the ad placement. You can create your placement id from Facebook developers page.

- (instancetype)
initWithPlacementID: (NSString *)placementID
NS_DESIGNATED_INITIALIZER;
Declared In: FBNativeAd.h
loadAd

Begins loading the FBNativeAd content.

- (void) loadAd;
Discussion:

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:

This is a method to associate a FBNativeAd with the UIView you will use to display the native ads.

ParameterDescription
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.

- (void)
registerViewForInteraction: (UIView *)view
withViewController: (UIViewController *)viewController;
Discussion:

The whole area of the UIView will be clickable.

Declared In: FBNativeAd.h
registerViewForInteraction:withViewController:withClickableViews:

This is a method to associate FBNativeAd with the UIView you will use to display the native ads and set clickable areas.

ParameterDescription
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).

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.

- (void)
registerViewForInteraction: (UIView *)view
withViewController: (UIViewController *)viewController
withClickableViews: (NSArray *)clickableViews;
Declared In: FBNativeAd.h
unregisterView

This is a method to disconnect a FBNativeAd with the UIView you used to display the native ads.

- (void) unregisterView;
Declared In: FBNativeAd.h