-
Creator 版本: 2.4.4 字节跳动开发者工具3.04和3.06都有问题
-
目标平台: 字节跳动小游戏
-
重现方式:
直接用
https://docs.cocos.com/creator/manual/zh/publish/publish-bytedance-sub-domain.html
这个文档的例子
https://github.com/cocos-creator/OpenDataContext_TestCase
打包到字节跳动开发者工具即可重现,必现 -
首个报错:
VM125:1 TypeError: at onTouchEnd callback function Cannot read property ‘forEach’ of undefined at Object.postMessage (dev-sub-context.js:13) at Object.EO [as postMessage] (eval at (game.html?uniqId=90002:338), :31:69000) at T.r.onEnable (eval at (game.html?uniqId=90002:338),
317627) at T.r.invokeOnEnable [as _invoke] (eval at (game.html?uniqId=90002:338),
229700) at T.r.invoke (eval at (game.html?uniqId=90002:338),
228086) at T.r.activateNode (eval at (game.html?uniqId=90002:338),
373295) at T.r.set [as active] (eval at (game.html?uniqId=90002:338),
554228) at e.onToggle (eval at (game.html?uniqId=90002:338),
2020) at T.r.emit (eval at (game.html?uniqId=90002:338),
247280) at Function.emitEvents (eval at (game.html?uniqId=90002:338),
246964)
| (anonymous) | @ | VM125:1 | |
|---|---|---|---|
| Vx | @ | VM125:1 | |
| (anonymous) | @ | VM125:1 | |
| xt | @ | VM125:1 | |
| t | @ | VM125:1 | |
| pk.emit | @ | VM125:1 | |
| oO.forEach.e.(anonymous function) | @ | VM125:31 | |
| window.bytedGame.canvas.addEventListener | @ | game.html?uniqId=90002:309 |
window.subContext = {
postMessage: function (args) {
window.subContext[‘messageHandler’].forEach(item => {
typeof item === “function” && item(deepCopy(args));
})
},
sharedCanvas: sCanvas
};
- 之前哪个版本是正常的: 或者字节跳动开发者1.9.7是正常的吧,文档上至少用的这个版本
- 手机型号:
- 手机浏览器:
- 编辑器操作系统:
- 重现概率: 必现