v1.2.0无法运行在安卓webview环境下的问题

app先将资源下载到本地再用webview打开游戏。 就会出现报错信息 Fetch API cannot load file:///xxx/src/import-map.json. URL scheme “file” is not supported.
引擎版本号v1.2.0,上一个版本v1.1.1没有这个问题。

目前采用的解决方案是用XMLHttpRequest 替代fetch

3.1.2也有这个问题,URL scheme “file” is not supported

用了物理引擎的怎么解决啊

要改一下引擎

解决了,加个这个就OK了

function fetchLocal(url) {
return new Promise(function (resolve, reject) {
var xhr = new XMLHttpRequest
xhr.onload = function () {
resolve(new Response(xhr.response, {
status: xhr.status
}))
}
xhr.onerror = function () {
reject(new TypeError(‘Local request failed’))
}
xhr.open(‘GET’, url)
xhr.responseType = “arraybuffer”;
xhr.send(null)
})
};
window.fetch = fetchLocal;

1赞

66666~ …

有个问题,大佬留给联系方式呗。

大佬,能详细教一教吗