GMSAutocompleteViewController仅显示5个结果 [英] GMSAutocompleteViewController showing only 5 results

查看:259
本文介绍了GMSAutocompleteViewController仅显示5个结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在应用程序中集成了 GMSAutocompleteViewController .

I integrated GMSAutocompleteViewController in my app.

let autocompleteController = GMSAutocompleteViewController()
autocompleteController.delegate = self
let filter = GMSAutocompleteFilter()
filter.type = .address
autocompleteController.autocompleteFilter = filter

// Display the autocomplete view controller.
present(autocompleteController, animated: true, completion: nil)    

这始终只显示5个结果.另外,该行为似乎有些怪异.首先,当我在搜索中输入 J 时,将显示5个结果.编写了更多文本并将其删除以再次将搜索文本设置为 J 后,我得到-无法加载结果.然后除非重新启动我的应用程序,否则永远不会显示结果.
我在Android中使用AutocompleteSupportFragment尝试了相同的实现,效果很好.看到 拉维的答案 ,以及其他几个. 但是,如果启用计费是解决方案,为什么在不启用计费的情况下在Android上可以正常运行?

This always shows only 5 results. Also, the behaviour seems to be a bit weird. At first when I write J in the search, 5 results are displayed. After writing some more text and removing those to again set the search text as J, I get - Can't load results. And then results are never displayed unless I relaunch my app.
I tried the same implementation in Android using AutocompleteSupportFragment and it works very well. I was earlier wondering after seeing Ravi's answer, and few others as well. But if enabling billing was the solution, why is it working fine in Android without enabling billing ?

推荐答案

我假设您已启用Google Places API,并且在该项目的Google Developer Console下也没有应用程序限制.表示存在一个有关 API和计费

I am assuming that you have Google Places API enabled and as well you have no application restrictions under your Google Developer Console for that project. Said that there is a Google page about APIs and billing

  1. Android和iOS Places API可能有所不同,因此对于某些API,您可能需要启用计费功能:

  1. Android and iOS Places APIs might differ, and hence for some APIs you might need to enable billing:

某些API允许免费使用,但要达到礼节性的使用限制,在某些情况下, 启用计费功能时,此免费限额会有所提高.

Some APIs allow free usage up to a courtesy usage limit, and in some cases this free limit is increased when you enable billing.

  • 也许在您的Android应用中,您使用的是链接到已启用计费的项目的API,对于iOS应用,您使用的是与未启用计费的另一个项目相关的API.

  • Maybe in your Android App you are using an API linked to a project that has billing enabled and for your iOS App you are using an API linked to another project where billing is not enabled.

    在项目级别(而不是API级别)启用结算.如果你 为一个项目启用计费,然后为该项目中的每个可计费API 根据项目的使用情况计费.项目中的所有用法是 使用您指定的付款方式进行结算,然后可以进行更改 随时采用其他方法.您无法选择性地启用 为某些API计费,但不为其他API计费;当您为某个帐户启用结算时 项目,它适用于您在该项目中使用的所有API, 即使当前已禁用该API.

    Billing is enabled at the project level, not the API level. If you enable billing for a project, then every billable API in that project is billed, based on the project's usage. All usage in a project is billed using the payment method that you specify, and you can change to a different method at any time. You cannot selectively enable billing for some APIs but not others; when you enable billing for a project, it applies to all the APIs that you used within that project, even if the API is currently disabled.

  • 也许与您在Android App Project中使用的Places SDK的版本有关,并且某些内部功能可能会影响您是否要使用其更新的API版本(需要启用或不启用结算功能).为此假设,请检查迁移到New Places SDK客户端中所述的信息.

    Maybe something is related to the version of Places SDK you are using in your Android App Project and some of its inner functionality could affect if you are going to talk to their updated APIs version which requires Billing to be enabled or not. Check information stated in Migrating to the New Places SDK Client for this assumption.

    最后,正如Google在Android版Places SDK,iOS版Places SDK,Places API中的大量文档中所述,它们在每篇文章的开头都带有红色警告,表示在每个项目中都应启用Billing.如果我所有的before语句均失败,则可能意味着它们在不同批次的用户/项目中应用了Billing和API功能限制的规则,因此您的android应用项目可能仍属于尚未推出的批次启用强制开票"选项.

    Lastly, as stated from lots of documentations from Google in Places SDK for Android, Places SDK for iOS, Places API, they all have a red warning in the beginning of each article saying that in each project you should enable Billing. If all my before statements fails, it might mean that they are applying the rule of Billing and APIs functionality restriction in different batches of users/projects, and hence your android app project might have fall in a batch that still hasn't rolled out to force Billing option enabled.

    这篇关于GMSAutocompleteViewController仅显示5个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆