GoogleMobileAds Framework Reference

GADNativeAd

@interface GADNativeAd : NSObject

Native ad. To request this ad type, pass GADAdLoaderAdTypeNative (see GADAdLoaderAdTypes.h) to the |adTypes| parameter in GADAdLoader’s initializer method. If you request this ad type, your delegate must conform to the GADNativeAdLoaderDelegate protocol.

  • Headline.

    Declaration

    Swift

    var headline: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *headline;
  • Text that encourages user to take some action with the ad. For example “Install”.

    Declaration

    Swift

    var callToAction: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *callToAction;
  • Icon image.

    Declaration

    Swift

    var icon: GADNativeAdImage? { get }

    Objective-C

    @property (nonatomic, strong, readonly, nullable) GADNativeAdImage *icon;
  • Description.

    Declaration

    Swift

    var body: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *body;
  • Array of GADNativeAdImage objects.

    Declaration

    Swift

    var images: [GADNativeAdImage]? { get }

    Objective-C

    @property (nonatomic, strong, readonly, nullable) NSArray<GADNativeAdImage *> *images;
  • App store rating (0 to 5).

    Declaration

    Swift

    @NSCopying var starRating: NSDecimalNumber? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSDecimalNumber *starRating;
  • The app store name. For example, “App Store”.

    Declaration

    Swift

    var store: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *store;
  • String representation of the app’s price.

    Declaration

    Swift

    var price: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *price;
  • Identifies the advertiser. For example, the advertiser’s name or visible URL.

    Declaration

    Swift

    var advertiser: String? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSString *advertiser;
  • Media content. Set the associated media view’s mediaContent property to this object to display this content.

    Declaration

    Swift

    var mediaContent: GADMediaContent { get }

    Objective-C

    @property (nonatomic, readonly, nonnull) GADMediaContent *mediaContent;
  • Optional delegate to receive state change notifications.

    Declaration

    Swift

    weak var delegate: (any GADNativeAdDelegate)? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) id<GADNativeAdDelegate> delegate;
  • Reference to a root view controller that is used by the ad to present full screen content after the user interacts with the ad. The root view controller is most commonly the view controller displaying the ad.

    Declaration

    Swift

    weak var rootViewController: UIViewController? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) UIViewController *rootViewController;
  • Dictionary of assets which aren’t processed by the receiver.

    Declaration

    Swift

    var extraAssets: [String : Any]? { get }

    Objective-C

    @property (nonatomic, copy, readonly, nullable) NSDictionary<NSString *, id> *extraAssets;
  • Information about the ad response that returned the ad.

    Declaration

    Swift

    var responseInfo: GADResponseInfo { get }

    Objective-C

    @property (nonatomic, readonly, nonnull) GADResponseInfo *responseInfo;
  • Called when the ad is estimated to have earned money. Available for allowlisted accounts only.

    Declaration

    Swift

    var paidEventHandler: GADPaidEventHandler? { get set }

    Objective-C

    @property (nonatomic, copy, nullable) GADPaidEventHandler paidEventHandler;
  • Indicates whether custom Mute This Ad is available for the native ad.

    Declaration

    Swift

    var isCustomMuteThisAdAvailable: Bool { get }

    Objective-C

    @property (nonatomic, readonly, getter=isCustomMuteThisAdAvailable) BOOL customMuteThisAdAvailable;
  • An array of Mute This Ad reasons used to render customized mute ad survey. Use this array to implement your own Mute This Ad feature only when customMuteThisAdAvailable is YES.

    Declaration

    Swift

    var muteThisAdReasons: [GADMuteThisAdReason]? { get }

    Objective-C

    @property (nonatomic, readonly, nullable) NSArray<GADMuteThisAdReason *> *muteThisAdReasons;
  • Registers ad view, clickable asset views, and nonclickable asset views with this native ad. Media view shouldn’t be registered as clickable.

    Declaration

    Swift

    func register(_ adView: UIView, clickableAssetViews: [GADNativeAssetIdentifier : UIView], nonclickableAssetViews: [GADNativeAssetIdentifier : UIView])

    Objective-C

    - (void)registerAdView:(nonnull UIView *)adView
           clickableAssetViews:
               (nonnull NSDictionary<GADNativeAssetIdentifier, UIView *> *)
                   clickableAssetViews
        nonclickableAssetViews:
            (nonnull NSDictionary<GADNativeAssetIdentifier, UIView *> *)
                nonclickableAssetViews;

    Parameters

    clickableAssetViews

    Dictionary of asset views that are clickable, keyed by asset IDs.

    nonclickableAssetViews

    Dictionary of asset views that are not clickable, keyed by asset IDs.

  • Unregisters ad view from this native ad. The corresponding asset views will also be unregistered.

    Declaration

    Swift

    func unregisterAdView()

    Objective-C

    - (void)unregisterAdView;
  • Reports the mute event with the mute reason selected by user. Use nil if no reason was selected. Call this method only if customMuteThisAdAvailable is YES.

    Declaration

    Swift

    func muteThisAd(with reason: GADMuteThisAdReason?)

    Objective-C

    - (void)muteThisAdWithReason:(nullable GADMuteThisAdReason *)reason;
  • Unconfirmed click delegate.

    Declaration

    Swift

    weak var unconfirmedClickDelegate: (any GADNativeAdUnconfirmedClickDelegate)? { get set }

    Objective-C

    @property (nonatomic, weak, nullable) id<GADNativeAdUnconfirmedClickDelegate> unconfirmedClickDelegate;
  • Registers a view that will confirm the click.

    Declaration

    Swift

    func registerClickConfirmingView(_ view: UIView?)

    Objective-C

    - (void)registerClickConfirmingView:(nullable UIView *)view;
  • Cancels the unconfirmed click. Call this method when the user fails to confirm the click. Calling this method causes the SDK to stop tracking clicks on the registered click confirming view and invokes the -nativeAdDidCancelUnconfirmedClick: delegate method. If no unconfirmed click is in progress, this method has no effect.

    Declaration

    Swift

    func cancelUnconfirmedClick()

    Objective-C

    - (void)cancelUnconfirmedClick;
  • Indicates whether the custom click gestures feature can be used.

    Declaration

    Swift

    var isCustomClickGestureEnabled: Bool { get }

    Objective-C

    @property (nonatomic, readonly, getter=isCustomClickGestureEnabled) BOOL customClickGestureEnabled;
  • Enables custom click gestures. Must be called before the ad is associated with an ad view. Available for allowlisted accounts only.

    Declaration

    Swift

    func enableCustomClickGestures()

    Objective-C

    - (void)enableCustomClickGestures;
  • Records a click triggered by a custom click gesture.

    Declaration

    Swift

    func recordCustomClickGesture()

    Objective-C

    - (void)recordCustomClickGesture;