AI助手支持GPT4.0
IOS端 当Promise与异步函数一起使用时 特定情况下永远不会settledIOS side When Promise is used with asynchronous function, it will never be settled under certain circumstances
IOS端 当Promise与异步函数一起使用时 特定情况下永远不会settled
框架类型 | 问题类型 | 终端类型 | 微信版本 | 基础库版本 |
小程序 | Bug | 微信iOS客户端 | 8.0.16 | 2.22.3 |
const app = getApp()function wait(delay) { return new Promise(resolve => setTimeout(resolve, delay))}const requestAuth = async() => { return request(false)}async function request(auth = true) { await Promise.resolve() await wait(300); if (auth) { await requestAuth() } return true}Page({ onLoad() { request().then( () => { wx.showModal({ title: '在ios上始终无法出现的modal', }) }, console.error ) },})
Framework type problem type terminal type wechat version basic library version applet bug wechat IOS client 8.0.16 2.22.3 const app = getapp() function wait (delay) {return new promise (resolve = > setTimeout (resolve, delay))} const} requestauth = async() = > {return} async} function request (auth = true) {await {promise. Resolve() await} wait (300); if (auth) {await {requestauth()} return} true} page ({onload() {request(). Then (() = > {/ / this will not be executed here in IOS. No error will be reported. Wx.showmodal( {Title: 'module that cannot appear on IOS',})}, console Error)},}) code snippet https://developers.weixin.qq.com/s/L6obm6mt70w3
1、碰到过。一律放弃promise方式,改e5异步的写法。