o
ffLocationChange 调用频繁出错,如何处理?
wx.getLocation 提示不能过于频繁使用,按公告改变获取方式后吗,更新 offLocationChange 等接口后,却检测到频繁报错?
initLocat: function () {
var self = this;
try {
wx.startLocationUpdate({
success(res) {
console.log("startLocationUpdate res=>", res)
},
fail(err) {
console.log("startLocationUpdate err=>", err)
}
})
const _locationChangeFn = function (result) {
console.log('location change', result)
self.setEleValue("wom_location", {
latitude: result.latitude,
longitude: result.longitude,
});
wx.offLocationChange(_locationChangeFn);
setTimeout(() => {
wx.stopLocationUpdate({
success(res) {
console.log("stopLocationUpdate res=>", res)
},
fail(err) {
console.log("stopLocationUpdate err=>", err)
}
})
}, 1500);
}
wx.onLocationChange(_locationChangeFn);
} catch (e) {
}
}
你好,请问现在还有报错吗?
每天都在增加呀