此问题只出现在ios上,game.json开启iOSHighPerformance,iOSHighPerformance+之后,android和pc都是正常的。
然后游戏里执行以下代码,会输出:errMsg:"canvasToTempFilePath:fail"
const w = 750;
const h = 586;
const tmpCanvas = wx.createCanvas();
tmpCanvas.width = w;
tmpCanvas.height = h;
// todo draw something
tmpCanvas.toTempFilePath({
x: 0,
y: 0,
width: w,
height: h,
destWidth: w,
destHeight: h,
success: (res) => {
console.log(res);
resolve(res.tempFilePath);
},
fail: (res) => {
console.warn(res);
resolve("");
}
})