我实际上正在使用此代码
const pdfGenerator = async () => {
try {
FileSystem.downloadAsync(
`http://${api}`,
FileSystem.documentDirectory + `${_id}.pdf`
).then(async ({ uri }) => {
try {
const assetFile = await MediaLibrary.createAssetAsync(uri)
console.log(assetFile)
const album = await MediaLibrary.createAlbumAsync("Arq", assetFile, false)
console.log(album)
} catch (error) {
console.log(error)
}
})
.catch(error => {
console.log(error);
});
} catch (response) {
console.log("erro " + response)
alert("Arquivo indisponível!")
}
}
控制台响应表明相册和资产已创建,但是我无法在手机存储中找到相册。