使用了uuid库,打包安卓报错,crypto.getRandomValues() not supported.
https://github.com/uuidjs/uuid#getrandomvalues-not-supported

因为uuid里面没有crypto库,所以把下面保存为js文件,设置为cocos,导入为插件

//补丁
if (!window.crypto) {
    window.crypto = {};
}
if (!crypto.getRandomValues) {
    crypto.getRandomValues = function (array) {
        for (var i = 0, l = array.length; i < l; i++) {
            array[i] = Math.floor(Math.random() * 256);
        }
        return array;
    }
}

标签: none

添加新评论