美文网首页
NSURLSession网络相关

NSURLSession网络相关

作者: iOS白水 | 来源:发表于2018-01-31 22:45 被阅读0次

    1.构成
    NSURLSession
    NSURLSessionConfiguration
    NSURLSessionTask -task.taskIdentifier
    NSURLSessionDataTask
    2.代理
    2.1NSURLSessionTaskDelegate

    • (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler ;

    • (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error ;

    2.2NSURLSessionDataDelegate

    • (void)URLSession:(NSURLSession *)session
      dataTask:(NSURLSessionDataTask *)dataTask
      didReceiveResponse:(NSURLResponse *)response
      completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler ;

    • (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data;

    • (void)URLSession:(NSURLSession *)session
      dataTask:(NSURLSessionDataTask *)dataTask
      willCacheResponse:(NSCachedURLResponse *)proposedResponse
      completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler ;

    相关文章

      网友评论

          本文标题:NSURLSession网络相关

          本文链接:https://www.haomeiwen.com/subject/jbcrzxtx.html