Objective c iOS5-实现NSURLConnection sendAsynchronousRequest:

Objective c iOS5-实现NSURLConnection sendAsynchronousRequest:,objective-c,ios5,nsurlconnection,nsurlconnectiondelegate,Objective C,Ios5,Nsurlconnection,Nsurlconnectiondelegate,我熟悉使用以下方法。我知道,在使用以下方法时,您至少需要实现所需的协议方法: [NSURLConnection setConnection:[[NSURLConnection alloc] initWithRequest:request delegate:self]]; 有人能解释一下我在研究过程中还没有得到答案的事情吗 使用以下异步方法调用时会发生什么情况?是否有任何需要从NSURLConnection实现的协议方法 谢谢 [NSURLConnection sendAsynchronous

我熟悉使用以下方法。我知道,在使用以下方法时,您至少需要实现所需的协议方法:

 [NSURLConnection setConnection:[[NSURLConnection alloc] initWithRequest:request delegate:self]];
有人能解释一下我在研究过程中还没有得到答案的事情吗

使用以下异步方法调用时会发生什么情况?是否有任何需要从NSURLConnection实现的协议方法

谢谢

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

                        //Handle response here 
                    });

查看文档,您不需要实现任何协议

这将提供与使用
sendSynchronousRequest:returningResponse:error:
相同的结果,除了:

1) 您的请求将是异步的


2) 处理程序将在您传递的队列中执行。

查看文档,您不需要实现任何协议

这将提供与使用
sendSynchronousRequest:returningResponse:error:
相同的结果,除了:

1) 您的请求将是异步的


2) 您的处理程序将在您经过的队列中执行。

不完全正确。您提供的队列是要在其上执行完成块的队列,而不是要在其上执行同步请求的队列。您提供的队列是要在其上执行完成块的队列,而不是要在其上执行同步请求的队列。