ionic ios cordova plugin问题

上传文件不支持filepath

定位不支持通过第三方接口获取经纬度 只能先用ionic推荐的geolocation拿到经纬度再由第三方转化

 getLocation(noAuto?) {
        try {
            if (BMap != undefined) {
                // if (this.nativeService.isAndroid()) {
                let geolocation = new BMap.Geolocation();
                // 开启SDK辅助定位
                geolocation.enableSDKLocation();
                geolocation.getCurrentPosition(r => {
                    let myGeo = new BMap.Geocoder();
                    // 根据坐标得到地址描述
                    myGeo.getLocation(new BMap.Point(r.point.lng, r.point.lat), result => {
                        if (result) {
                            this.setLocation(result.addressComponents.city, noAuto)
                        }
                    });
                });
                // }
                if (this.nativeService.isIos()) {
                    this.geolocation.getCurrentPosition().then((resp) => {
                        let myGeo = new BMap.Geocoder();
                        // 根据坐标得到地址描述
                        myGeo.getLocation(new BMap.Point(resp.coords.longitude, resp.coords.latitude), result => {
                            if (result) {
                                this.setLocation(result.addressComponents.city, noAuto)
                            }
                        });
                    }).catch((error) => {
                        console.log('Error getting location', error);
                    });
                }


            }
        } catch (e) {
            console.log(e);
        }

    }

 

你可能感兴趣的:(ionic ios cordova plugin问题)