expo-camera returns 无效的 base-64 编码图像

expo-camera returns invalid base-64 encoded image

每当我尝试使用 expo-camera 拍照时,它 returns 一个无效的 base64 编码字符串。

const {base64} = await cameraRef.takePictureAsync(options={base64:true,quality:0});
console.log(isBase64(base64)); // returns false

我检查了一下,变量base64似乎保存了一个base64编码的字符串。但是如果我尝试使用它,它被证明是无效的。有人有解决办法吗?

相机返回的base64有问题,所有的加号都换成了空格。要获得有效的 base64 字符串,您所要做的就是用加号替换所有出现的空格。 base64=base64.replaceAll(" ","+")