ios NSURLSession completeHandler默认调用quque

注意 ,

[[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%?),而是在子线程中执行。

posted @ 2015-07-21 11:01  幻化成疯  阅读(298)  评论(0编辑  收藏  举报