Questions tagged [nsurlsessiontask]
55 questions
3
votes
1 answer
NSURLSession: can't get resume data after calling cancelByProducingResumeData
I want to resume downloading after user cancels downloading or something wrong happens. But when I call cancelByProducingResumeData method, the resumeData is nil. So, I can't resume downloading. I'm sure the download link can be resumed, because our…

Han Pengbo
- 1,338
- 1
- 18
- 37
3
votes
1 answer
AuthenticationMethodServerTrust is nil in iOS 9
I have been trying to implement a way to do public key pinning in my iOS 8+ app using NSURLSession.
What I do is just implement the delegate method didReceiveChallenge and get the challenge.protectionSpace.authenticationMethod and check if it is…

VíctorVarLed
- 148
- 1
- 8
3
votes
1 answer
NSURLSessionTask completionTask never get call in main queue using GCD
I am using iOS 7 NSURLSession to do some simple GET to a RESTful service. This is what i did:
NSURLSessionConfiguration *sessionConfig = [NSURLSessionConfiguration ephemeralSessionConfiguration];
_session = [NSURLSession…

kawingkelvin
- 3,649
- 2
- 30
- 50
2
votes
1 answer
What happens when I call URLSessionTask's task.cancel()?
The reference for this method only says what happens locally on the client, and says nothing about what it potentially sends to the server. Apparently, our server has some challenges with receiving a lot of status code 499 from us when we cancel a…

Sti
- 8,275
- 9
- 62
- 124
2
votes
2 answers
NSURLSession background transfer : Callback for each video downloaded from a queue
I am using background transfer service for downloading multiple videos using NSURLSession. Downloading is working fine when the App is in background mode and I am satisfied with it. My problem is, I want callback for each video downloaded from a…

NSPratik
- 4,714
- 7
- 51
- 81
2
votes
1 answer
Calculating network speed in iOS. Round trip time with less data won't inform about exact network speed
I am trying to calculate network speed in my app, so I can upload only that much of data which can be uploaded in such network conditions. For that what my plan is:
My App will have a default speed may be (500KB/s).
My app will send request which…

Kapil Choubisa
- 5,152
- 9
- 65
- 100
2
votes
1 answer
Measuring total response time for NSURLSession's dataTaskWithRequest
When using NSURLSession's dataTaskWithRequest how can total response time be measured in the event that many NSURLSessionDataTask are created and will not necessarily be executed immediately? Storing a starting time and calculating the difference…

mservidio
- 12,817
- 9
- 58
- 84
2
votes
0 answers
Using NSURLSessionDataTask, can I resume downloading a file, even if user comes back after quitting an App?
Suppose, I am downloading a file of 300 MB using NSURLSessionDownloadTask or NSURLSessionDataTask (at present, I don’t know which is the best choice in my case). User quits the App or App suddenly crashed while 250 MB were downloaded. When next…

NSPratik
- 4,714
- 7
- 51
- 81
2
votes
0 answers
NSURLSessionDownloadTask finishes with no file at the location URL
I fire a bunch of downloads using NSURLSessionDownload tasks and NSURLSession with background configuration. Most of the time everything works fine but sometimes there is no temp file at the location specified in the delegate callback method. It…

dariaa
- 6,285
- 4
- 42
- 58
2
votes
2 answers
What is the recommended way to intercept and prevent redirects with AFNetworking 2.0?
It seems to me that the proper place to do this is in AFURLSessionManager, in setting the taskWillPerformHTTPRedirection block, but I am unsure of the best way to handle it.
Currently, in my AFHTTPSessionManager subclass, I am setting the redirect…

coneybeare
- 33,113
- 21
- 131
- 183
1
vote
1 answer
Cancel Downloadtask pending
I have two view controller
Controller A and controller B
In controller A i have a button to present view controller B.
In controller B i have a button download(to download start with below code) and a back button (dismiss view controller B to go…

9to5ios
- 5,319
- 2
- 37
- 65
1
vote
1 answer
File downloader Using NSURLSessionTask downloadTask
I want to create File download manager to download multiple files with download percent with play pause delete functionality .
I try below code to download multiple file successfully ...but unable to add progress bar please help
for (int i = 0; i…

9to5ios
- 5,319
- 2
- 37
- 65
1
vote
3 answers
NSURLSession/NSURLConnection HTTP load failed (kCFStreamErrorDomainSSL, -9802 in iOS10, 2017
THIS IS NOT A REPEATED QUESTION, READ ON. I am upgrading the deprecated code in my app to iOS10 compliance.
THE ERROR:
NSURLSession is giving me trouble, with this infamous error, along with 9806 and 9801, depending on what I put on the .plist…

Josh
- 6,251
- 2
- 46
- 73
1
vote
2 answers
NSURLsession background transfer service for download task, can it work even when App is suspended?
Before asking a question, let me clarify what I understand about iOS App states:
Backgrounded: In this state, your app is not in the foreground anymore but it is still able to run code.
Suspended: Your app enters this state when it’s no longer able…

NSPratik
- 4,714
- 7
- 51
- 81
1
vote
0 answers
Unexpected behaviour of URLSession while trying to get bytes uploaded
My application is continuously communicating with server and I want to calculate the bandwidth I am getting. For that I decided to calculate upload and download speed.
I am using NSURLSession to communicate with my server. What I am doing is:…

Kapil Choubisa
- 5,152
- 9
- 65
- 100