NativeGeocoderReverseResult

NativeGeocoderReverseResult

模块“”“”没有导出成员“NativeGeocoderReverseResult”。
L13:从'@ionic-native/geolocation/ngx'导入{地理位置};
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);
        })
    }

最佳答案

使用 ionic docs 中的代码时,我遇到了同样的问题:https://ionicframework.com/docs/native/native-geocoder

然后我发现 NativeGeocoderReverseResult 替换为 NativeGeocoderResult : https://github.com/sebastianbaar/cordova-plugin-nativegeocoder/releases

关于angular - 模块 '" "' 在 ionic 3 Geolocation 中没有导出成员 'NativeGeocoderReverseResult',我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/55652890/

10-12 02:38