【问题标题】:How to solve "Error from the server while geocoding...." in React native?如何在 React Native 中解决“地理编码时服务器出错......”?
【发布时间】:2019-02-21 07:17:34
【问题描述】:

在 react native 中使用 Geocoder 获取地址时出现此错误:

对象{ “代码”:4, "message": "地理编码时来自服务器的错误。接收到的数据在错误的 'origin' 字段中。检查它以获取更多信息。", “起源”:对象{ “结果”:数组 [], “状态”:“零结果”, }, }

我正在使用“react-native-geocoding”依赖项

我的代码包括在这里:

Geocoder.init(GOOGLE_API_KEY); //google api key
Geocoder.from(latitude,longitude)
.then(json => {
  var addressComponent = json.results[0].address_components;
  console.log(JSON.stringify(addressComponent));      
})
.catch(error => console.warn(error));

需要帮助吗?

【问题讨论】:

  • 我也遇到了同样的问题,你找到解决办法了吗?
  • 你能展示你的其余代码吗,'GOOGLE_API_KEY'声明在哪里?

标签: react-native google-api google-geocoder


【解决方案1】:

我通过更改 google API 密钥解决了这个问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-03-18
    • 1970-01-01
    • 2020-07-19
    • 1970-01-01
    • 2019-06-17
    • 2021-06-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多