Siarhei Fedartsou
Siarhei Fedartsou

Reputation: 1873

Wait for NSURLConnection completion

My application must receive few contents of files from the Internet in separated threads (I use NSThread). But thread method completes before content of file is received (because NSURLConnection works asynchronously). And I can't be sure that my file is downloaded when thread is completed.

Upvotes: 0

Views: 387

Answers (1)

Eimantas
Eimantas

Reputation: 49354

send a synchronous request:

id data = [NSURLConnection sendSynchronousRequest:myRequest returningResponse:&myResponse error:nil];

Upvotes: 2

Related Questions