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 best solutions below
Related Questions in NSURLCONNECTION
- Difference between a connection failed or no response in an https connection in iPhone
- CFNetwork SSLHandshake failed iOS 9
- Xcode 7 beta NSURLConnection error
- NSURLConnection not calling methods (worked the first time)
- Simpliest solution to check if File exists on a webserver. (Swift)
- Downloading a PDF file and saving it to temporary directory iOS
- NSURLConnection throws after updating to Swift 2.0
- connectionDidFinishLoading calls before image has downloaded?
- NSUrlConnection Delegate methods are not getting called from helper class
- Need alternative of NSURLConnection sendSynchronousRequest
- NSURLConnection response's expectedContentLength -1
- Swift - Return data from NSURLSession when sending POST request
- How to Send JSON String with Special Charaters in iOS?
- "Too many HTTP redirects" from iOS to Apache/JBoss Server
- NSString's initWithContentsOfFile is failing to load any zip File.
Related Questions in NSURLCONNECTIONDELEGATE
- NSUrlConnection Delegate methods are not getting called from helper class
- NSURLConnection - Get HTTP status code on request failure
- Wait till the delegate methods finish executing in ios
- connection release method in connectionDidFinishLoading, causes error
- NSMutableURLRequest "The request timed out" issue . .
- Updating progress bar for a download-- NSURLConnectionDataDelegate didReceiveData gets only called once
- Implementing NSURLConnectionDataDelegate Protocol
- iOS NSURLConnection with SSL: Accepting an expired self-signed certificate
- Safe Casting, but EXC_BAD_ACCESS anyway
- NSURLConnection Delegate not working
- Redirected URL in UIWebview not loading images
- Can't extract certificate (Error -26275)
- How https request is handling using NSURLConnection
- IOS app crashes after sending request (object releases)
- Objective C: SSL Pining
Related Questions in SENDASYNCHRONOUSREQUEST
- NSIS: Make async web request with query string
- Variable only updated in the sendAsynchronousRequest
- How to use Asihttprequest asynchronous requests server?
- NSURLConnection sendAsynchronousRequest wait time in iOS
- NSURLConnection gets a NULL value from server though response data is not NULL - iOS
- Cancel NSURLConnection started with sendAsynchronousRequest:queue:completionHandler:?
- Multiple Async HTTP connections to Tornado Server
- NSURLConnection sendAsynchronousRequest returning null response in error scenario
- Change NSURLConnection from sendSynchronousRequest to sendAsynchronousRequest?
- NSURLConnection sendAsynchronousRequest results in "A server with the specified hostname could not be found"
- Auto fill text on web service call response
- How to know how many asynchronous calls are pending
- Can't fix `NotFoundException` error when calling SendApiAsset in AWS CLI
- Is it possible to trigger events for google spreadsheet API V4 on save of new data on googlesheet?
- Facing an issue with NSURLSessionDataTask with SynchronousRequest in objective-c
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)
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?
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: