react native – Pdf file not viewing in doc listing of IOS

0
22
react native – Pdf file not viewing in doc listing of IOS


I’m making an attempt to obtain a file in react native however utilizing library (ReactNativeBlobUtil). for android it’s working positive however for IOS the file goes in doc listing however not on the specified location. it’s going underneath the a number of folders and there too it isn’t accessible.

const downloadReport = async () => {
    attempt {
      const { dirs } = ReactNativeBlobUtil.fs;
      const dirToSave = LAYOUT.isiOS ? dirs.DocumentDir : dirs.LegacyDownloadDir;
      const date = new Date();
      const fileName = `obtain${Math.ground(
        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"));
    }
  };

that is the file location i get within the IOS.

/var/cell/Containers/Information/Utility/54A6714F-9875-4612-A0AB-EDC92FA65C15/Paperwork/ReactNativeBlobUtil_tmp/ReactNativeBlobUtilTmp_mlp7gzc9srh232rrggpngt

and as i’m downloading the pdf file however the file extension shouldn’t be there. The saved file’s sort is knowledge. which isn’t desired.

That is my information.plist file the place i’ve added the required permissions.

UIFileSharingEnabled

CFBundleGetInfoString

LSApplicationCategoryType

LSSupportsOpeningDocumentsInPlace

 UIFileSharingEnabled

NSDownloadsFolderUsageDescription

I’ve tried including these permissions in information.plist file however nothing labored. Kindly give me some strategies easy methods to repair this.

LEAVE A REPLY

Please enter your comment!
Please enter your name here