Skip to content

Instantly share code, notes, and snippets.

@floriankugler
Last active September 29, 2023 15:56
Star You must be signed in to star a gist
Save floriankugler/6870499 to your computer and use it in GitHub Desktop.
Mapping of NSURLConnection to NSURLSession delegate methods. Created by Mattt Thompson.
NSURLConnection | NSURLSession
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connectionShouldUseCredentialStorage: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connection:willSendRequestForAuthenticationChallenge: | NSURLSessionDelegate URLSession:didReceiveChallenge:completionHandler:
| NSURLSessionTaskDelegate URLSession:task:didReceiveChallenge:completionHandler:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connection:willCacheResponse: | NSURLSessionDataDelegate URLSession:dataTask:willCacheResponse:completionHandler:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDelegate connection:didFailWithError: | NSURLSessionTaskDelegate URLSession:task:didCompleteWithError:
NSURLConnectionDataDelegate connectionDidFinishLoading: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDataDelegate connection:willSendRequest:redirectResponse: | NSURLSessionTaskDelegate URLSession:willPerformHTTPRedirection:newRequest:completionHandler:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDataDelegate connection:didReceiveResponse: | NSURLSessionDataDelegate URLSession:dataTask:didReceiveResponse:completionHandler:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDataDelegate connection:didReceiveData: | NSURLSessionDataDelegate URLSession:dataTask:didReceiveData:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDataDelegate connection:needNewBodyStream: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDataDelegate connection:didSendBodyData:totalBytesWritten:totalBytesExpectedToWrite: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDownloadDelegate connection:didWriteData:totalBytesWritten:expectedTotalBytes: | NSURLSessionTaskDelegate URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDownloadDelegate connectionDidResumeDownloading:totalBytesWritten:expectedTotalBytes: |
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
NSURLConnectionDownloadDelegate connectionDidFinishDownloading:destinationURL: | NSURLSessionDownloadDelegate URLSession:downloadTask:didFinishDownloadingToURL:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
| NSURLSessionDelegate URLSession:didBecomeInvalidWithError:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
| NSURLSessionDataDelegate URLSession:dataTask:didBecomeDownloadTask:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
| NSURLSessionDataDelegate URLSessionDidFinishEventsForBackgroundURLSession:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
| NSURLSessionDownloadDelegate URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:
------------------------------------------------------------------------------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------
| NSURLSessionDownloadDelegate URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:
@wanggang316
Copy link

Thanks!

@githubdelegate
Copy link

Thanks

@YuliiaVeres
Copy link

Thanks !!!

@ifwrite
Copy link

ifwrite commented Feb 25, 2016

Thanks

@matchboxy
Copy link

lift saver, tks

@seyi
Copy link

seyi commented Apr 20, 2016

wow..thanks

@melochale
Copy link

great, thanks a lot.

@starmuse
Copy link

nice

@deckarlc
Copy link

deckarlc commented Sep 1, 2016

wow, nice~

@naeemshaikh90
Copy link

Great Work

@wongzigii
Copy link

👍

@Jerry4me
Copy link

Marvelous! Thanks.

@carlosvKC
Copy link

Yeah! Gracias

@rememberkarl
Copy link

Thanks a lot!

@xiaohuiCoding
Copy link

Good!Thanks!

@himyfairy
Copy link

many thanks!

@timcolla
Copy link

Still helping developers in 2018!

@zihanzzz
Copy link

awesome to see this! thanks.

@coderChrisLee
Copy link

Thanks a lot.

@wving5
Copy link

wving5 commented Mar 1, 2019

Good job, thx.
connection:didWriteData:totalBytesWritten:expectedTotalBytes: matching URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:, is it an unintentional mistake ?

@Deniffer
Copy link

Thinks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment