码迷,mamicode.com
首页 > Web开发 > 详细

NSURLSession各文件关系

时间:2017-11-21 14:37:37      阅读:205      评论:0      收藏:0      [点我收藏+]

标签:null   nsarray   invoke   sda   文件   任务   eset   net   bit   

NSURLSession   通过session创建任务

 

@property (class, readonly, strong) NSURLSession *sharedSession; 

+ (NSURLSession *)sessionWithConfiguration:(NSURLSessionConfiguration *)configuration;

+ (NSURLSession *)sessionWithConfiguration:(NSURLSessionConfiguration *)configuration delegate:(nullable id <NSURLSessionDelegate>)delegate delegateQueue:(nullable NSOperationQueue *)queue;

 

@property (readonly, retain) NSOperationQueue *delegateQueue;

@property (nullable, readonly, retain) id <NSURLSessionDelegate> delegate;

@property (readonly, copy) NSURLSessionConfiguration *configuration;

@property (nullable, copy) NSString *sessionDescription;

 

- (void)finishTasksAndInvalidate;

- (void)invalidateAndCancel;

 

- (void)resetWithCompletionHandler:(void (^)(void))completionHandler;   

- (void)flushWithCompletionHandler:(void (^)(void))completionHandler;  

 

- (void)getTasksWithCompletionHandler:(void (^)(NSArray<NSURLSessionDataTask *> *dataTasks, NSArray<NSURLSessionUploadTask *> *uploadTasks, NSArray<NSURLSessionDownloadTask *> *downloadTasks))completionHandler; 

- (void)getAllTasksWithCompletionHandler:(void (^)(NSArray<__kindof NSURLSessionTask *> *tasks))completionHandler API_AVAILABLE(macos(10.11), ios(9.0), watchos(2.0), tvos(9.0)); /* invokes completionHandler with all outstanding tasks.

- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request;

 

- (NSURLSessionDataTask *)dataTaskWithURL:(NSURL *)url;

 

- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromFile:(NSURL *)fileURL;

 

- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromData:(NSData *)bodyData;

 

- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request;

 

 - (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request;

 

- (NSURLSessionDownloadTask *)downloadTaskWithURL:(NSURL *)url;

 

- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData;

 

- (NSURLSessionStreamTask *)streamTaskWithHostName:(NSString *)hostname port:(NSInteger)port API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0)) __WATCHOS_PROHIBITED;

- (NSURLSessionStreamTask *)streamTaskWithNetService:(NSNetService *)service API_AVAILABLE(macos(10.11), ios(9.0), tvos(9.0)) __WATCHOS_PROHIBITED;

 

NSURLSessionConfiguration 通过configuration创建session

 

NSURLSessionTask   任务

 

NSURLSessionDataTask : NSURLSessionTask  普通任务

NSURLSessionUploadTask : NSURLSessionDataTask 上传任务

NSURLSessionDownloadTask : NSURLSessionTask  下载任务

NSURLSessionStreamTask : NSURLSessionTask

 

NSURLSessionDelegate  session代理

NSURLSessionTaskDelegate <NSURLSessionDelegate>

 

NSURLSessionDataDelegate <NSURLSessionTaskDelegate>

NSURLSessionDownloadDelegate <NSURLSessionTaskDelegate>

NSURLSessionStreamDelegate <NSURLSessionTaskDelegate>

 

NSURLSession各文件关系

标签:null   nsarray   invoke   sda   文件   任务   eset   net   bit   

原文地址:http://www.cnblogs.com/yang-shuai/p/7872023.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!