模块'“”'没有导出的成员'NativeGeocoderReverseResult'。 L13:从“ @ ionic-native / geolocation / ngx”导入{Geolocation}; L14:导入{NativeGeocoder,NativeGeocoderOptions,NativeGeocoderReverseResult} Error In Console
getUserLocation(){
let options: NativeGeocoderOptions = {
useLocale: true,
maxResults: 5
};
this.geolocation.getCurrentPosition().then(resp => {
this.nativeGeocoder.reverseGeocode(resp.coords.latitude, resp.coords.longitude, options)
.then((result: NativeGeocoderReverseResult[]) => {
this.userlocation = result[0].toString();
}, error => {
console.log(error)
});
}, error => {
console.log('Error getting location', error);
})
}
答案 0 :(得分:0)
使用离子文档中的代码时,我遇到了同样的问题:https://ionicframework.com/docs/native/native-geocoder
然后我发现 NativeGeocoderReverseResult替换为NativeGeocoderResult :https://github.com/sebastianbaar/cordova-plugin-nativegeocoder/releases
v3.2.0
...
**突破性变化**
用NativeGeocoderResult替换NativeGeocoderForwardResult
用NativeGeocoderResult替换NativeGeocoderReverseResult