概览
检索搜索广告并将其提供给 SDK 的客户端。
此类继承 NSObject。
实例方法摘要 | |
(instancetype) | - NS_UNAVAILABLE |
(instancetype) | - initWithPublisherID:styleID:options:delegate: |
初始化广告控制器。更多... | |
(void) | - loadAds: |
以异步方式检索指定 adRequest 的广告首页,并根据需要检索后续页面。更多... | |
(void) | - loadMoreAds |
针对上次调用 loadAds: 指定的上一个请求,以异步方式检索下一个广告页面。更多... | |
(NSInteger) | - adCount |
返回最近调用 loadAds: 时加载的广告总数。更多... | |
(GANAdView *) | - adView |
创建一个空 adView。更多... | |
(void) | - populateAdView:identifier: |
使用标识符指定的广告填充 adView。更多... | |
(void) | - populateAdView:identifier:completionHandler: |
使用由标识符指定的广告填充 adView,并在该广告准备好展示时调用完成处理程序。更多... | |
属性摘要 | |
NSString * | publisherID |
广告请求的发布商 ID。更多... | |
NSString * | styleID |
用于广告请求的设置 ID。更多... | |
GANSearchAdControllerOptions * | options |
用于所有广告请求的选项。更多... | |
GANExperimentVariantStatus | experimentVariantStatus |
最近投放的样式是实验变体、实验对照组,还是未选择用于实验。更多... | |
方法详细信息
- (instancetype) initWithPublisherID: | (NSString *) | publisherID | |
styleID: | (NSString *) | styleID | |
options: | (nullable GANSearchAdControllerOptions *) | options | |
delegate: | (nullable id< GANSearchAdControllerDelegate >) | delegate | |
初始化广告控制器。
- 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 |
以异步方式检索指定 adRequest
的广告首页,并根据需要检索后续页面。
此方法应为每个请求仅调用一次。当新广告加载(或加载失败)时,系统会在主线程上调用 GANSearchAdControllerDelegate
。
- Parameters
-
adRequest The GANSearchAdRequest query.
- (void) loadMoreAds |
针对上次调用 loadAds:
指定的上一个请求,以异步方式检索下一个广告页面。
如果未调用 loadAds:
,这将通过 GANSearchAdControllerDelegate
返回错误。如果存在整页未展示的广告,也会向代理返回错误。
- (NSInteger) adCount |
返回最近调用 loadAds:
时加载的广告总数。
- (GANAdView *) adView |
创建一个空 adView。
- (void) populateAdView: | (GANAdView *) | view | |
identifier: | (NSString *) | adIdentifier | |
使用标识符指定的广告填充 adView。
- 如果
adIdentifier
是新标识符,视图将显示下一个可用的广告。 - 如果已使用
adIdentifier
,该视图将显示首次使用adIdentifier
调用此方法时显示的广告。- 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 | |
使用由标识符指定的广告填充 adView,并在该广告准备好展示时调用完成处理程序。
- 如果
adIdentifier
是新标识符,视图将显示下一个可用的广告。 - 如果已使用
adIdentifier
,该视图将显示首次使用adIdentifier
调用此方法时显示的广告。- 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.
房源详情
|
readnonatomiccopy |
广告请求的发布商 ID。
|
readnonatomiccopy |
用于广告请求的设置 ID。
|
readnonatomicstrong |
用于所有广告请求的选项。
|
readnonatomicassign |
最近投放的样式是实验变体、实验对照组,还是未选择用于实验。