[错误:位置“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)
| 归档时间: |
|
| 查看次数: |
472 次 |
| 最近记录: |