我能够从Web应用程序下载文件,但是当我尝试从apk下载文件时,我会在网络标签中看到响应(请参见屏幕截图),但它默默失败...我需要将文件下载到手机
这些是我在config.xml文件中使用的插件:
<plugin name="cordova-plugin-whitelist" spec="1" />
<plugin name="cordova-plugin-device" spec="^2.0.3" />
<plugin name="cordova-plugin-battery-status" spec="^2.0.3" />
<plugin name="cordova-plugin-inappbrowser" spec="^3.2.0" />
<plugin name="cordova-plugin-splashscreen" spec="^5.0.3" />
<plugin name="cordova-plugin-advanced-http" spec="^2.4.1" />
<plugin name="cordova-plugin-file-transfer" spec="^1.7.1" />
<plugin name="cordova-plugin-file" spec="^6.0.2" />
<plugin name="cordova-plugin-filechooser" spec="^1.2.0" />
,这是单击按钮时调用的代码:
downloadCV() {
this.resumeService
.downloadCV(this.userID)
.pipe(takeUntil(this.ngUnsubscribe))
.subscribe(
(data) => {
const blob = new Blob([data], {
type: "application/octet/stream",
});
this.fileUrl = this.sanitizer.bypassSecurityTrustUrl(
window.URL.createObjectURL(blob)
);
setTimeout(() => {
this.generateCV.nativeElement.click();
}, 500);
},
(error) => {
console.log("error", error);
}
);
}