我正在使用#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();
}
)
有没有人可以帮助我。
<preference name="iosPersistentFileLocation" value="Library" />
<preference name="iosPersistentFileLocation" value="Compatibility" />
在 iOS 设备上有两个有效的位置可以存储持久文件:Documents 目录和 Library 目录。以前版本的插件只在 Documents 目录中存储持久文件。这具有使应用程序的所有文件在 iTunes 中可见的副作用,这通常是意外的,特别是对于处理大量小文件的应用程序,而不是生成完整的导出文档,这是目录的预期目的。
现在可以选择是将文件存储在文档目录还是库目录中,首选项位于应用程序的 config.xml 文件中。为此,请将这两行之一添加到 config.xml
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句