3***@qq.com
3***@qq.com
  • 发布:2020-10-20 18:09
  • 更新:2020-10-20 18:09
  • 阅读:887

【报Bug】ios系统不会进入 onPoiSearchComplete 兴趣点检索事件

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 64位操作系统

HBuilderX类型: 正式

HBuilderX版本号: 2.9.3

手机系统: iOS

手机系统版本号: iOS 13.4

手机厂商: 苹果

手机机型: apple-xr

页面类型: vue

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
onReady() {  
            let map = uni.createMapContext('map', this);  
            this.searchObj = new plus.maps.Search(map);  
            let self = this;  

            self.searchObj.onPoiSearchComplete =function( state, result ){    
//ios不进入这里  完全没有执行 onPoiSearchComplete 事件  安卓系统完全正常   
                let startPoint = turf.point([self.myLocation.longitude, self.myLocation.latitude]);  
                if ( state == 0 ) {  
                    if ( result.currentNumber <= 0 ) {    
                        console.log( "没有检索到结果" );  
                    }else{  
                        let list = result.poiList;  
                        for (let i = 0; i < list.length; i++) {  
                            let endPoint = turf.point([list[i].point.longitude, list[i].point.latitude]);  
                            list[i].distance = turf.distance(startPoint, endPoint).toFixed(1);  
                        }  
                        self.list = self.list.concat(list);  
                        if(self.list.length>0&&self.index==0){  
                            self.list[0].checked = true;  
                            let path = '';  
                            let point = self.list[0].point;  
                            if(self.doMove){  
                                self.moveToLocation(point);  
                                self.doMove = false;  
                            }  
                        }  
                        self.chooseAddr=list[0];//默认把获取到得第一个地址放入进去  
                    }  
                } else {  
                    console.log( "检索失败" );    
                }    
            }  
            this.getLocation();  
        },  
methods:{  
getLocation() { // 获取当前位置  
                this.index = 0;  
                this.list = [];  
                uni.getLocation({  
                    type:"gcj02",  
                    geocode:true,  
                    success:(res)=> {  
                        this.longitude = res.longitude;  
                        this.latitude = res.latitude;  
                        this.myLocation = {  
                            longitude: res.longitude,  
                            latitude: res.latitude  
                        }  
                        this.doMove = true;  
                        let point = new plus.maps.Point(res.longitude, res.latitude);  
                        //let point = new plus.maps.Point(115.922815, 28.688186);  
                        this.searchCity = res.address.city;  
                        this.getNearbyPoi(point);  
                    },  
                    fail:(err)=> {  
                        console.log(err)  
                    }  
                })  
            },  
            getNearbyPoi(point,index=0){ // 获取附近poi  
                this.searchObj.poiSearchNearBy(' ', point, 2000, index);  
            },  
}  

操作步骤:

预期结果:

实际结果:

bug描述:

左图安卓进入 完全能获取列表,ios进入就不会执行 onPoiSearchComplete 事件,不知道是不是兼容的问题,求大神解答

2020-10-20 18:09 负责人:无 分享
已邀请:

该问题目前已经被锁定, 无法添加新回复