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 
                    });
Était-ce utile?

La 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.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top