Ionic framework 文件传输,onProgress无法在iOS上工作(IONIC3)
我一直在使用Ionic native的fileTransfer,它在Android上运行得很好,但在iOS上却什么都不做 这是我的密码:Ionic framework 文件传输,onProgress无法在iOS上工作(IONIC3),ionic-framework,ionic2,ionic3,ionic-native,Ionic Framework,Ionic2,Ionic3,Ionic Native,我一直在使用Ionic native的fileTransfer,它在Android上运行得很好,但在iOS上却什么都不做 这是我的密码: getFile(fileName,url){ let fileTransfer: FileTransferObject = this.transfer.create(); fileTransfer.download(url, this.file.dataDirectory + fileName).then((entry) =>
getFile(fileName,url){
let fileTransfer: FileTransferObject = this.transfer.create();
fileTransfer.download(url, this.file.dataDirectory + fileName).then((entry) => {
console.log('entry:',entry)
}, (error) => { console.log(error); });
console.log('file transfer',fileTransfer.onProgress)
var a = fileTransfer.onProgress((progressEvent: ProgressEvent) => {
this.ngzone.run(() => {
console.log(progressEvent.loaded)
});
});
}
这取决于如何派生此.file.dataDirectory 就我而言,它总是这样工作
declare var cordova:any; //on top of file
if (this.platform.is('android')) {
this.fsurl = cordova.file.dataDirectory;
}else{
this.fsurl = cordova.file.documentsDirectory;
}
您好@enRaiser,谢谢您的帮助,但它仍然无法在iOS上运行,文件传输很好,buy I want show it progress,它下载了多少百分比或文件大小。它在Android上运行良好,但iOS完全没有显示任何内容。在这个repo中,有一个很好的例子可以让fileTransfer在iOS上运行:。我遵循了这个例子,它成功了。这个问题与范围界定有关。