Question

I am familiar with using the following method. I know that when using the following, you need to implement at least the required protocol methods:

 [NSURLConnection setConnection:[[NSURLConnection alloc] initWithRequest:request delegate:self]];

Can someone explain something that I have yet to been able to get an answer during my research?

What about when using the following asynchronous method call? Are there any required protocol methods that need to be implemented from NSURLConnection?

Thanks

[NSURLConnection sendAsynchronousRequest:request
                                   queue:queue
                       completionHandler:^(NSURLResponse *response,NSData *data,NSError *error) 
                    { 

                        //Handle response here 
                    });
Was it helpful?

Solution

Looking at the documentation, you don't need to implement any protocol.

This will give you the same result as using sendSynchronousRequest:returningResponse:error: except :

1) your request will be asynchronous

2)Your handler will be executed in the queue you passed.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top