1

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

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

有人可以解释一些我在研究期间还没有得到答案的东西吗?

使用下面的异步方法调用时呢?是否有任何必需的协议方法需要从 NSURLConnection 实现?

谢谢

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

                        //Handle response here 
                    });
4

1 回答 1

1

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

sendSynchronousRequest:returningResponse:error:这将为您提供与使用except相同的结果:

1)您的请求将是异步的

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

于 2012-07-31T19:26:04.883 回答