删除saveImage方法的catch,排查生产环境ios不能保存图片的原因
This commit is contained in:
parent
703f5abb94
commit
40f99064c6
|
@ -7,19 +7,14 @@ export default async function saveImage(uri) {
|
|||
if (permission.granted) {
|
||||
const timestamp = new Date().getTime();
|
||||
const fileUri = FileSystem.cacheDirectory + `${timestamp}.png`;
|
||||
try {
|
||||
const res = await FileSystem.downloadAsync(uri, fileUri);
|
||||
await MediaLibrary.saveToLibraryAsync(res.uri);
|
||||
Toast.show({
|
||||
type: "success",
|
||||
text1: "已保存到相册",
|
||||
topOffset: 60,
|
||||
});
|
||||
return true;
|
||||
} catch (err) {
|
||||
console.error("FS Err: ", err);
|
||||
return false;
|
||||
}
|
||||
const res = await FileSystem.downloadAsync(uri, fileUri);
|
||||
await MediaLibrary.saveToLibraryAsync(res.uri);
|
||||
Toast.show({
|
||||
type: "success",
|
||||
text1: "已保存到相册",
|
||||
topOffset: 60,
|
||||
});
|
||||
return true;
|
||||
} else {
|
||||
Toast.show({
|
||||
type: "error",
|
||||
|
|
Loading…
Reference in New Issue