Fogmeister
Fogmeister

Reputation: 77621

Is it possible to start an NSURLConnection multiple times?

I'm setting up a class to manage the download of some data. Due to the spec it has to be downloaded multiple times (as it may change). I can't change that but I have a question.

If I create a class that is dedicated to downloading the data so it is an NSURLConnectionDataDelegate etc...

Can I store the NSURLConnection as a property and set it up in the init and then reuse the same connection each time?

Or should I store the NSURLRequest and use the same request in a new connection each time?

The reason I ask is that the docs for NSURLConnection state...

"You cannot reschedule a connection after it has started."

and I'm not 100% sure what that means.

Upvotes: 0

Views: 78

Answers (1)

Ben Coffman
Ben Coffman

Reputation: 1740

Yes, as long as each time you have a unique object that creates the NSURLConnection. This is simply stating you can't have the same object "reschedule" a connection, mid connection.

Never hurts to run a simple test.

Upvotes: 1

Related Questions