检测IONIC本机FTP传输中的错误

问题描述 投票:0回答:2

有没有人知道如何检测Native FTP Plugin的下载/上传方法失败?阅读文档时,它表示该函数返回一个可观察对象,其中一个参数表示已完成的百分比。一旦该值达到1,就意味着传输完成。但是它没有说明失败......即使我将转移包含在try / catch中,它也不会触发....

例如 :

try
{
   this._ftp.download(localfile, remotefile).subscribe( (value) => {
      if ( value == 1)
           { alert("transfer completed !"); }
   });
}
catch ( Error ) {
  alert ("Error");    // Never triggered
}

谢谢,对不起我的英文!

ionic-framework ftp
2个回答
0
投票

仔细看看Logcat上的Logs。如果可能,请告诉我们结果。


0
投票

这是一个部分登录LogCat ..你可以看到如何启动,发送转移的“值”,并结束。在该文件之后,在队列中,还有另一个我已重命名的文件。调用函数Download,但我没有收到错误,正如你所看到的,logcat中没有任何内容....

2019-03-20 21:31:48.489 13324-24078/es.hazi.filecopy I/CDVFtpTransferListener: Transfer started
2019-03-20 21:31:48.532 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=5760, percent=0.0329912
2019-03-20 21:31:48.536 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=14400, percent=0.08247801
2019-03-20 21:31:48.572 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=20160, percent=0.11546921
2019-03-20 21:31:48.579 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=28800, percent=0.16495602
2019-03-20 21:31:48.581 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=43200, percent=0.24743402
2019-03-20 21:31:48.611 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=46080, percent=0.2639296
2019-03-20 21:31:48.613 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=57600, percent=0.32991204
2019-03-20 21:31:48.617 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=100800, percent=0.577346
2019-03-20 21:31:48.651 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=103680, percent=0.5938417
2019-03-20 21:31:48.653 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=115200, percent=0.6598241
2019-03-20 21:31:48.661 13324-24078/es.hazi.filecopy D/CDVFtpTransferListener: Transferred, totalSize=174592, curSize=174592, percent=1.0
2019-03-20 21:31:48.751 13324-24078/es.hazi.filecopy I/CDVFtpTransferListener: Transfer completed
2019-03-20 21:31:48.838 13324-13329/es.hazi.filecopy I/zygote64: Do partial code cache collection, code=249KB, data=178KB
2019-03-20 21:31:48.840 13324-13329/es.hazi.filecopy I/zygote64: After code cache collection, code=249KB, data=178KB
2019-03-20 21:31:48.840 13324-13329/es.hazi.filecopy I/zygote64: Increasing code cache capacity to 1024KB
2019-03-20 21:31:53.658 13324-13324/es.hazi.filecopy D/CordovaActivity: Paused the activity.
© www.soinside.com 2019 - 2024. All rights reserved.