Is it possible to cancel an
NSURLConnectionstarted withsendAsynchronousRequest:queue:completionHandler:?Why doesn't
sendAsynchronousRequest:queue:completionHandler:return theNSURLConnectionobject it creates so that I can cancel it?
Cancel NSURLConnection started with sendAsynchronousRequest:queue:completionHandler:?
3.9k views Asked by ma11hew28 At
1
There are 1 answers
Related Questions in NSURLCONNECTION
- NSURLSessionDownloadTask results in 404 status when server issues a redirect
- URLSession mysteriously fails on cell network only
- How to share cookies between WebView and NSURLConnection?
- In Xcode 14 & iOS 16 - purple warning when downloading an image from URL with NSData dataWithContentsOfURL
- RapidApi and Swift
- How Can I get Image data from specific URI in Swift?
- NSURLConnection switch to NSURLSession returning 404 response
- Getting date from web, returns nil
- sharedContainerIdentifier on NSURLConnection?
- A single "|" character in the URL breaks loading contents of URL
- I am getting EXC_BAD_INSTRUCTION in NSUrlConnection sendSynchronousRequest
- NSURLErrorDomain code 1200 and 1004 in a cordova hybrid app
- Task <E94BEE4D-E88B-4827-BE0A-E5CF1FE35F5C>.<0> HTTP load failed, 0/0 bytes (error code: -1200 [3:-9858])
- Nested nsurl dataTaskWithRequest but after the completion handler called
- How do I change NSURLConnection sendSynchronousRequest to include basic authentication for a HTTPS connection
Related Questions in NSURLCONNECTIONDELEGATE
- NSURLConnection always TRUE
- FreePascal / Lazarus and implementing nsurlconnectiondatadelegate
- NSURLConnection - Get HTTP status code on request failure
- NSURLConnectionDelegate object losing delegate value
- Ambiguous use of 'connection(_:didReceive:)'
- How to convert the exponential value to normal decimal or without exponent format in Swift?
- NSURLConnection delegate methods are not executing
- How to get http body in NSURLConnectionDelegate willSendRequestForAuthenticationChallenge
- auto login issue with HTTPS site with unstrusted SSL Certificate in swift
- Can an SSL connection succeed if the client doesn't provide a client certificate in iOS?
- call NSUrlSessionConnection delegate methods when viewcontroller is deallocated
- NSURLConnection and NSURLConnectionDataDelegate: connection callbacks are not fired
- Is NSURLConnectionDataDelegate's didReceiveData method throttled?
- How to access NSURLConnection Delegate property
- Fifth NSURLConnection's delegate not called
Related Questions in SENDASYNCHRONOUSREQUEST
- How can I download an url source html to a string in autohotkey v2
- Can't fix `NotFoundException` error when calling SendApiAsset in AWS CLI
- How to keep on requesting on a set of URLs asynchronously (python)?
- How to make send() call asynchronous?
- How to create Asynchronous Camel-kafka consumer?
- How to make multiple api calls with python requests
- Syntax error in SiddhiQL, no viable alternative at input '@sink'
- Not able to execute the Synchronous Request Response example in Siddhi
- Attempting to make an asynchronous Api Request save the response data as part of an object
- Multiple Async HTTP connections to Tornado Server
- How to throttle Grequests when making asynchronous API calls?
- How to manage the 5 seconds response timeout limit in Dialogflow / Api.ai?
- How to pick latest api call when multiple api call were made
- iOS: How to test Internet connection in the most easy way, without freezing the app (without Reachability)?
- How to achieve cascading http post calls in angularjs?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
EDIT - Since my provided answer seems to have been wrong, you should check out the following related question and its answers:
How can I cancel an asynchronous call through NSURLConnection sendAsynchronousRequest?
Old answer:
In your header of your class (e.g. ViewController), declare an operation queue:
To download a file call something like the following:
To cancel the download later on call: