首页 > 移动平台 > 详细

ios NSURLSession completeHandler默认调用quque

时间:2015-07-21 12:11:36      阅读:216      评论:0      收藏:0      [点我收藏+]

注意 ,

[[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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!