Ionic FileTransfer
,但它总是返回以下响应:
附言:是的
是下载的直接链接
我真的不知道这个代码有什么问题
{
代码:空,
来源:空,
目标:空
我的代码:
const storageDirectory = '';
this.platform.ready().then(() => {
storageDirectory = cordova.file.externalRootDirectory;
let url = this.apiURL + itemId
const fileTransfer: FileTransferObject = this.transfer.create();
fileTransfer.download(url, storageDirectory + "item" + itemId+ ".xml")
.then(response => {
const alertSuccess = this.alertCtrl.create({
title: `Successfully downloaded!`,
subTitle: `The file is in: \n: ${response.toURL()}`,
buttons: ['Ok']
});
alertSuccess.present();
})
.catch(err => {
const alert = this.alertCtrl.create({
title: 'Error!',
subTitle: 'Try again!',
buttons: [{
text: 'OK',
handler: () => {
this.util.getPermission();
}
}]
});
alert.present();
});
})
}