我正在使用 GMSAutocompleteResultsViewController 进行谷歌自动完成搜索。当我用这个搜索时,它显示的结果非常有限。它不显示所有结果。此外,当它在 android 中使用时,它会显示很多结果。请让我知道我缺少什么。
override func viewDidLoad() {
super.viewDidLoad()
resultsViewController = GMSAutocompleteResultsViewController()
resultsViewController?.delegate = self
searchController = UISearchController(searchResultsController: resultsViewController)
searchController?.searchResultsUpdater = resultsViewController
// Put the search bar in the navigation bar.
searchController?.searchBar.sizeToFit()
navigationItem.titleView = searchController?.searchBar
// When UISearchController presents the results view, present it in
// this view controller, not one further up the chain.
definesPresentationContext = true
// Prevent the navigation bar from being hidden when searching.
searchController?.hidesNavigationBarDuringPresentation = false
}
最佳答案
我自己找到了答案。适用于 iOS 的 Google API 仅提供 5 个搜索结果,而 Android 则提供更多结果。您可以引用以下链接
https://developers.google.com/places/web-service/autocomplete#place_autocomplete_responses
关于ios - GMSAutocompleteResultsViewController 显示有限的结果?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51146560/