Код: Выделить всё
const downloadReport = async () => {
try {
const { dirs } = ReactNativeBlobUtil.fs;
const dirToSave = LAYOUT.isiOS ? dirs.DocumentDir : dirs.LegacyDownloadDir;
const date = new Date();
const fileName = `download${Math.floor(
date.getDate() + date.getSeconds() / 2
)}.pdf`;
const config = {
fileCache: true,
addAndroidDownloads: {
useDownloadManager: true,
notification: true,
path: `${dirToSave}/${fileName}`,
description: t("downloading"),
},
addIOSDownloads: {
notification: true,
path: `${dirToSave}/${fileName}`,
description: t("downloading"),
},
};
await ReactNativeBlobUtil.config(config)
.fetch("GET", FILE_URL, {})
.then((res) => {
console.log("The file saved to ", res.path());
});
showSuccessMessage(t("fileDownloadedSuccessfully"));
} catch (error) {
showErrorMessage(t("failedToDownloadFile"));
}
};
/var/mobile/containers/data/application/54a6714f-9875-4612-a0ab-edc92fa65c15/documents/Reactnativeblobutil_tmp/Reactnativeblobutiltmp_mlp7gzc9srh2322rgpngt
Я попытался добавить эти разрешения в файл info.plist, но ничего не сработало. Пожалуйста, дайте мне несколько предложений, как это исправить.
Подробнее здесь: https://stackoverflow.com/questions/789 ... ory-of-ios
Мобильная версия