【发布时间】: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