인기 검색어

인기 급상승 검색어 보기

인기 급상승 검색어를 가져오려면 ContextualSearchRuntime에서 getTrendingSearches 메서드를 호출합니다. 이 메서드는 반환되는 인기 급상승 검색어의 최대 개수를 지정할 수 있는 단일 GetTrendingSearchesOptions를 사용합니다.

반환된 SearchSuggestions 객체에는 액세스 가능한 속성이 없습니다. 여기에는 인기 급상승 검색어를 렌더링하는 데 필요한 모든 정보가 포함되어 있지만 그 외에는 불투명합니다.

Swift는 Swift 동시 실행 스타일을 사용하고 Objective-C는 콜백 함수를 사용합니다.

Swift

getTrendingSearches(withOptions:)

Task {
    let suggestions = try await searchRuntime.getTrendingSearches(
            withOptions: GetTrendingSearchesOptions())
}

Objective-C

getTrendingSearchesWithOptions

  [searchRuntime
      getTrendingSearchesWithOptions:
            [[GetTrendingSearchesOptions alloc] init]
                             completionHandler:^(SearchSuggestions *_Nullable suggestions,
                                                 NSError *_Nullable error) {
                              // error will be not null if there is an error.
                              // On success, suggestions will be non null.
                            }];

디스플레이

인기 급상승 검색어 칩을 표시하려면 추천 검색어와 동일한 방법을 사용하세요.

다음: 검색 결과 표시