标签:
注意 ,
[[NSURLSession sharedSession] dataTaskWithRequest:request completionHandler:^(NSData *data, NSURLResponse *response, NSError *error)
这种方法用了默认配置,那么completeHanlder不会在mainQueue中执行,看下面的官方文档:
A queue for scheduling the delegate calls and completion handlers. If nil
, the session creates a serial operation queue for performing all delegate method calls and completion handler calls.
这样的结果就是completeHandler不在主线程执行(100%?),而是在子线程中执行。
ios NSURLSession completeHandler默认调用quque
标签:
原文地址:http://www.cnblogs.com/breezemist/p/4663800.html