使用 expo 选取文档时位置不可读

Luc*_*ias 6 react-native expo

[错误:位置“file:///data/user/0/host.exp.exponent/cache/DocumentPicker/68f6fec2-feff-48e1-a0cc-d8fe5f54bc0b.pdf”不可读。]

尝试从 expo DocumentPicker 读取 Base64 文件时出现此错误

在Android上使用expo sdk 48和最新的expo go应用程序,不知道在IOS上

这是我正在使用的代码:

const file = await DocumentPicker.getDocumentAsync({
    type: "application/pdf",
    copyToCacheDirectory: true,
});

if (file.type === "cancel") return;

try {
    const base64 = await FileSystem.readAsStringAsync(file.uri, { encoding: "base64" });
    console.log(base64);
} catch (error) {
    console.log(error);
    setErrorModal(true);
}
Run Code Online (Sandbox Code Playgroud)