删除saveImage方法的catch,排查生产环境ios不能保存图片的原因

This commit is contained in:
yezian 2024-03-23 12:47:46 +08:00
parent 703f5abb94
commit 40f99064c6
1 changed files with 8 additions and 13 deletions

View File

@ -7,7 +7,6 @@ export default async function saveImage(uri) {
if (permission.granted) { if (permission.granted) {
const timestamp = new Date().getTime(); const timestamp = new Date().getTime();
const fileUri = FileSystem.cacheDirectory + `${timestamp}.png`; const fileUri = FileSystem.cacheDirectory + `${timestamp}.png`;
try {
const res = await FileSystem.downloadAsync(uri, fileUri); const res = await FileSystem.downloadAsync(uri, fileUri);
await MediaLibrary.saveToLibraryAsync(res.uri); await MediaLibrary.saveToLibraryAsync(res.uri);
Toast.show({ Toast.show({
@ -16,10 +15,6 @@ export default async function saveImage(uri) {
topOffset: 60, topOffset: 60,
}); });
return true; return true;
} catch (err) {
console.error("FS Err: ", err);
return false;
}
} else { } else {
Toast.show({ Toast.show({
type: "error", type: "error",