FTP 多文件传输
如果我必须按顺序进行多次 ftp 传输,如何在 iPhone 应用程序上等待 ftp 传输结束?
我调用相同的方法进行传输,更改文件名。
[Ftp receiveFtp:file1]; [Ftp 接收Ftp:file2]; [Ftp receiveFtp:file3];
例如,在这里,我应该等待第一个方法结束,然后再调用第二个方法。 有什么想法吗?
谢谢,安德里亚
How can I wait the end of an ftp transfer on my iPhone app, if I have to do many ftp transfers in sequence?
I call the same method to make the transfers, changing the name of file.
[Ftp receiveFtp:file1];
[Ftp receiveFtp:file2];
[Ftp receiveFtp:file3];
Here, for example, I should wait the end of the first method before calling the second.
Any ideas?
Thanks, Andrea
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将所有文件名放入一个集合(即 NSMutableArray)中,并在完成下载的处理程序中,从数组中弹出下一个文件,只要列表不为空,就开始下一次下载。
Put all your filenames in a collection (i.e. NSMutableArray), and in your handler for a completed download, pop the next one from the array and start the next download as long as the list isn't empty.
我猜 Ftp 正在另一个线程上完成工作,或者您不会问如何等待方法终止来执行它的追随者?
如果这个假设成立,那么我建议您创建一个协议方法,告诉您的委托(您的父类)ftp 传输已完成,这将启动以下文件。
I guess Ftp is doing its work on another thread, or you would not ask how to wait for a method to terminate to execute it's follower ?
if that assumption is true, then I suggest you make a protocol method that will tell to your delegate (your parent class) that the ftp transfer has finished, which will start the following file.