Xcode: Wait for a NSURLConnetcion to download content

I am programming an iPhone app. Now i want to download the contents of a text file and display them in a view.

The problem is that the view loads faster than the NSURLConnection can download the data. Is there a way to wait for the download before displaying the view?

Upvotes: 2

Views: 376

Answers (1)

Micah Hainline
Micah Hainline

Reputation: 14427

You could try [NSURLConnection sendSynchronousRequest: request returningResponse: response error: &error];

A better solution would be to wait for the callback, and in the meantime show a spinner.

Upvotes: 2

Related Questions