GoogleMobileAds Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
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.
-
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;
-
Declaration
Objective-C
@property (nonatomic, strong, readonly, nullable)
GADNativeAdImage
*icon;
-
Declaration
Swift
var body: String? { get }
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *body;
-
Array of GADNativeAdImage objects.
Declaration
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
Objective-C
@property (nonatomic, readonly, nonnull)
GADMediaContent
*mediaContent;
-
Optional delegate to receive state change notifications.
-
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
Objective-C
@property (nonatomic, readonly, nonnull)
GADResponseInfo
*responseInfo;
-
Called when the ad is estimated to have earned money. Available for allowlisted accounts only.
-
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
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
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.
-
Unconfirmed click delegate.
-
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;
Except as otherwise noted, the content of this page is licensed under the
Creative Commons Attribution 4.0 License
, and code samples are licensed under the
Apache 2.0 License
. For details, see the
Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]