Overview
Retrieves search ads and makes them available to the client of the SDK.
Inherits NSObject.
Instance Method Summary | |
(instancetype) | - NS_UNAVAILABLE |
(instancetype) | - initWithPublisherID:styleID:options:delegate: |
Initializes the ad controller. More... | |
(void) | - loadAds: |
Retrieves, asynchronously, the first page of ads for the given adRequest , and subsequent pages as needed. More... | |
(void) | - loadMoreAds |
Retrieves, asynchronously the next page of ads for the previous request specified by the last call to loadAds: . More... | |
(NSInteger) | - adCount |
Returns the total number of ads loaded from the most recent call to loadAds: . More... | |
(GANAdView *) | - adView |
Create an empty adView. More... | |
(void) | - populateAdView:identifier: |
Populate an adView with the ad specified by the identifier. More... | |
(void) | - populateAdView:identifier:completionHandler: |
Populate an adView with the ad specified by the identifier and call the completion handler when the ad is ready to be displayed. More... | |
Property Summary | |
NSString * | publisherID |
The publisher id used for ad requests. More... | |
NSString * | styleID |
The settings id used for ad requests. More... | |
GANSearchAdControllerOptions * | options |
The options used for all ad requests. More... | |
GANExperimentVariantStatus | experimentVariantStatus |
Whether the most recently served style is an experiment variant, an experiment control, or was not selected for an experiment. More... | |
Method Detail
- (instancetype) initWithPublisherID: | (NSString *) | publisherID | |
styleID: | (NSString *) | styleID | |
options: | (nullable GANSearchAdControllerOptions *) | options | |
delegate: | (nullable id< GANSearchAdControllerDelegate >) | delegate | |
Initializes the ad controller.
- Parameters
-
publisherID The publisher id, e.g. "ms-app-pub-9616389000213823". styleID The settings id for the template that will be used to render native ads. options GANSearchAdControllerOptions, such as adTest, and adSafe, etc. delegate GANSearchAdControllerDelegate for receiving notifications when ads are loaded and other events.
- (void) loadAds: | (GANSearchAdRequest *) | adRequest |
Retrieves, asynchronously, the first page of ads for the given adRequest
, and subsequent pages as needed.
This method should be called only once per request. When new ads are loaded (or fail to load) the GANSearchAdControllerDelegate
will be called on the main thread.
- Parameters
-
adRequest The GANSearchAdRequest query.
- (void) loadMoreAds |
Retrieves, asynchronously the next page of ads for the previous request specified by the last call to loadAds:
.
If loadAds:
has not been called, this will return an error through the GANSearchAdControllerDelegate
. If there is a full page of ads that have not been shown, this will also return an error to the delegate.
- (NSInteger) adCount |
Returns the total number of ads loaded from the most recent call to loadAds:
.
- (GANAdView *) adView |
Create an empty adView.
- (void) populateAdView: | (GANAdView *) | view | |
identifier: | (NSString *) | adIdentifier | |
Populate an adView with the ad specified by the identifier.
- if
adIdentifier
is a new identifier, the view will show the next available ad. - if
adIdentifier
has already been used, the view will show the same ad it showed the first time this method was called withadIdentifier
.- Parameters
-
view The GANAdView to populate. adIdentifier An ad identifier used to identify this ad. This can be any NSString. Each unique string will be assigned to the next available ad until ads are exhausted.
- (void) populateAdView: | (GANAdView *) | view | |
identifier: | (NSString *) | adIdentifier | |
completionHandler: | (GANAdViewPopulatedCompletionHandler) | completionHandler | |
Populate an adView with the ad specified by the identifier and call the completion handler when the ad is ready to be displayed.
- if
adIdentifier
is a new identifier, the view will show the next available ad. - if
adIdentifier
has already been used, the view will show the same ad it showed the first time this method was called withadIdentifier
.- Parameters
-
view The GANAdView to populate. adIdentifier An ad identifier used to identify this ad. This can be any NSString. Each unique string will be assigned to the next available ad until ads are exhausted. completionHandler The completion handler to be called when the ad view is ready to be displayed. Ad specific data will provided such as the height of the ad view.
Property Detail
|
readnonatomiccopy |
The publisher id used for ad requests.
|
readnonatomiccopy |
The settings id used for ad requests.
|
readnonatomicstrong |
The options used for all ad requests.
|
readnonatomicassign |
Whether the most recently served style is an experiment variant, an experiment control, or was not selected for an experiment.