苹果系统调用 tt.createBuffer 失败
53 浏览2025年09月22日作者:13126008352

function encodeString(str) {

        if (globalThis.wx && globalThis.wx.encode) {

          return new Uint8Array(globalThis.wx.encode({

            data: str || "",

            format: 'utf8'

          }));

        }else if (globalThis.tt && globalThis.tt.createBuffer) {

          console.log("小白Str:", str);

          var Buffer = globalThis.tt.createBuffer();

          var tempBuffer = Buffer.from(str, 'utf8');

          console.log("小白tempBuffer:", new Uint8Array(tempBuffer));

          return new Uint8Array(tempBuffer);

        } else {

          return window.encoder(str);

        }

      }


安卓系统正常运行

IOS系统运行失败

最后一次编辑于 2025 年 09 月 22 日
共 3 条评论

相关问答

专题推荐

热门文章

热门问答