itinance / itinance/react-native-fs

iOS 13.0+ production Downloadfile function isn't work . but 12.0+ is work,

Open
#815 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
5k
Forks
1k
PR merge metrics
No merged PRs in 30d

Description

1. "react-native": "^0.57.4",
2."react-native-fs": "^2.13.3",

in Development iOS 13.0+ is work . in Production iOS 13.0+ isn't work, but 12.0+ is work.
How to solve? ......

```
let dirs = Platform.OS === 'ios' ? RNFS.LibraryDirectoryPath : RNFS.ExternalDirectoryPath;
const downloadDest = `${dirs}/${timestamp + random}.jpg`;
const formUrl = uri;
const options = {
fromUrl: formUrl,
toFile: downloadDest,
background: true,
begin: (res) => {
},
};
const ret = RNFS.downloadFile(options);
ret.promise.then(res => {
let promise = CameraRoll.saveToCameraRoll(downloadDest);
promise.then(function (result) {
showToast(I18n.t('save_photo_success'));
if (Platform.OS == 'ios') {
try {
RNFS.unlink(downloadDest) //保存成功后删除缓存的照片.
} catch{ }
}
resolve('success');
// content://media/external/images/media/36218
}).catch(function (error) {
resolve('error');
});
}).catch(err => {

});
```
![1111](https://user-images.githubusercontent.com/26252165/69858215-84458b80-12cc-11ea-9ad3-2e7b8902652c.png)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.