在开发工具下正常,在手机上预览云函数没回调,经检验云函数已经在云端执行并返回,success, complete, fail都没有执行
代码片断
timeout() { return new Promise((resolve, reject) => { setTimeout(resolve({aa:1}), 1000) }) }, async testawait(e){ let timeout = await this .timeout() console.log( 'call timeout' , timeout) wx.cloud.callFunction({ name: 'test' , success: (res) => { console.log( 'success' , res) }, complete: (res) => { console.log( 'complete' , res) }, fail: (err) => { console.log( 'fail' , err) } }) }, |
也试过这样,第二个log 整 个没出来, 同样开发工具下正常,真手出事
timeout() { return new Promise((resolve, reject) => { setTimeout(resolve({aa:1}), 1000) }) }, async testawait(e){ let timeout = await this .timeout() console.log( 'call timeout' , timeout) let data=await wx.cloud.callFunction({ name: 'test' }) console.log( 'data' , data) }, |
遇到类似的问题,但不是调用云函数,是在await方法后iOS一直挂起不返回,偶尔正常