NSURLRequest *req = [[NSURLRequest alloc] initWithURL:[NSURL URLWithString:@"https://google.com"]];
NSURLConnection * connect = [[NSURLConnection alloc] initWithRequest:req delegate:self];
[connect start];
这是同步还是异步?默认情况下,NSURLConnection是哪一个?
这取决于您在NSURLConnection中调用哪种方法。但是大多数方法都与异步相关。除了sendSynchronousRequest:returningResponse:error之一:
同步加载数据
+ sendSynchronousRequest:returningResponse:error:
异步加载数据
+ connectionWithRequest:delegate:
– initWithRequest:delegate:
– initWithRequest:delegate:startImmediately:
+ sendAsynchronousRequest:queue:completionHandler:
– start
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句