Andrea Mattiuz
Andrea Mattiuz

Reputation: 89

Ftp multiple file transfer

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

Upvotes: 0

Views: 409

Answers (2)

Eiko
Eiko

Reputation: 25632

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.

Upvotes: 0

TheSquad
TheSquad

Reputation: 7506

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.

Upvotes: 1

Related Questions