我想知道两个NSURLConnection协议或方法(或者其实际称为什么)的区别。NSURLConnection connectionWithRequest:delegate和sendAsynchronousRequest:queue:completionHandler之间的主要区别是什么?
我很新来Objective-C编程,我试图创建一个iOS应用程序,从网站加载数据。我注意到在我看过/读过的教程中,当他们使用connectionWithRequest时,他们有其他方法在我看来是connectionWithRequest正常工作所需的方法。一个教程是this。这些方法是:
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response;
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
只是为了两个。关于这一点,我还有一个问题:当NSURLConnection connectionWithRequest:delegate被调用或使用时,这些方法会自动调用吗?
我提到的两个NSURLConnection协议究竟有什么区别?哪个更好用?