在 ios 中下载 ionic 3 的文件未显示在文件夹中

Tan*_*pta 1 file-transfer ionic-framework cordova-plugins ionic2 ionic3

离子3

我正在使用#cordova-plugin-file-transfer,从 android 和 ios 中的 url 下载文件。对于 Android 来说,它运行良好。但对于 ios 应用程序,我遇到了问题。

文件下载成功,但我无法在 ios 设备上看到下载的文件。

这是我的 ios 代码=>

const transfer = this.transfer.create();
transfer.download(url, cordova.file.documentsDirectory + fileName).then(
          entry => {
            console.log(entry);
            this.apiService.showError("Download Succeeded.");
            this.commonService.dismissLoading();
          },
          error => {
            console.log(error);
            this.apiService.showError("Download Failed.");
            this.commonService.dismissLoading();
          }
        )
Run Code Online (Sandbox Code Playgroud)

有谁可以在这方面帮助我吗?

Sah*_*hil 5

 <preference name="iosPersistentFileLocation" value="Library" />

  <preference name="iosPersistentFileLocation" value="Compatibility" />
Run Code Online (Sandbox Code Playgroud)

iOS 设备上有两个有效位置可存储持久文件:Documents 目录和 Library 目录。该插件的早期版本仅在文档目录中存储持久文件。这样做的副作用是使应用程序的所有文件在 iTunes 中可见,这通常是无意的,特别是对于处理大量小文件的应用程序,而不是生成用于导出的完整文档,而这正是目录的预期目的。

现在可以选择是否将文件存储在文档或库目录中,并在应用程序的 config.xml 文件中进行首选项。为此,请将这两行之一添加到 config.xml