0

I am creating an iOS app that consumes web services. I have a class that makes the connections and stores the response in a variable. It also has a status variable where 1 indicates successful connection. I have set up an NStimer and a function to check when the connection and download is done and if it was successful.

My question is:

Is this a proper way to manage the connection and its outcome? any suggestions?

4

1 に答える 1

0

Here is the programming guide from Apple Developer website and it describes how to use NSURLConnection delegate. You can manage the received data in connectionDidFinishLoading: method. Notice that using these delegate methods will load data asynchronously. If you want to handle data synchronously, please try sendSynchronousRequest:returningResponse:error:, but this function should never be call in the main thread.

于 2012-10-23T05:15:46.037 に答える