總覽
擷取搜尋廣告,並提供給 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: |
以 ID 指定的廣告填入 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 | |
以 ID 指定的廣告填入 adView。
- 如果
adIdentifier
是新 ID,檢視畫面會顯示下一個可用的廣告。 - 如果已使用
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
是新 ID,檢視畫面會顯示下一個可用的廣告。 - 如果已使用
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 |
最近放送的樣式是否為實驗變化版本、實驗組,或未獲選用於實驗。