Questions tagged [nsurlsessionconfiguration]

An NSURLSessionConfiguration object defines the behavior and policies to use when uploading and downloading data using an NSURLSession object. When uploading or downloading data, creating a configuration object is always the first step you must take. You use this object to configure the timeout values, caching policies, connection requirements, and other types of information that you intend to use with your NSURLSession object.

An NSURLSessionConfiguration object defines the behavior and policies to use when uploading and downloading data using an NSURLSession object. When uploading or downloading data, creating a configuration object is always the first step you must take. You use this object to configure the timeout values, caching policies, connection requirements, and other types of information that you intend to use with your NSURLSession object.

It is important to configure your NSURLSessionConfiguration object appropriately before using it to initialize a session object. Session objects make a copy of the configuration settings you provide and use those settings to configure the session. Once configured, the session object ignores any changes you make to the NSURLSessionConfiguration object. If you need to modify your transfer policies, you must update the session configuration object and use it to create a new NSURLSession object.

NOTE In some cases, the policies defined in this configuration may be overridden by policies specified by an NSURLRequest object provided for a task. Any policy specified on the request object is respected unless the session’s policy is more restrictive. For example, if the session configuration specifies that cellular networking should not be allowed, the NSURLRequest object cannot request cellular networking.

For more information about using configuration objects to create sessions, see NSURLSession Class Reference.

141 questions
1
vote
1 answer

NSURLSession & NSURLSessionConfig - Discarding Config Headers

I am having an issue with NSURLSession & NSURLSessionConfiguration and I am not sure if it is my code or I have an incorrect understanding of how the framework behaves. The issue I am facing is that headers I set at the session level are not…
1
vote
1 answer

iOS NSURLSessionConfiguration without Caching not working as intended

i am facing a security issue in iOS7. I want to make my url connection without any caching by doing the following configuration: +(NSURLSessionConfiguration *)createSessionConfig { NSURLSessionConfiguration *sessionConfig = …
Martin
  • 790
  • 2
  • 9
  • 24
1
vote
4 answers

iOS NSURLSessionUploadTask response data

I have successfully implemented the NSURLSessionUploadTask and work in both background and foreground. But there is an issue when reading the response data. - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask…
1
vote
1 answer

nsurlsession for multiple request in loop

I have been trying to download image/txt but i need to do it until that url exists & download that image/txt file,so i keep calling same method again & when i set debug point i see this . If url is right than i do not see any queue in debug…
1
vote
1 answer

Returning directory listing with PHP

I am using the following to return the listing of all text files on my server. echo json_encode(glob("*.{txt}", GLOB_BRACE)); The issue I am having is when I execute this php file from my app, with only one text file in the directory, it returns…
1
vote
1 answer

Is it possible to run code after uploading a file with NSURLSession configured as backgroundSessionConfiguration

I like to use the NSURLSession in backgroundSessionConfiguration with the method: uploadTaskWithRequest:fromFile: But I need to run some code after the upload to select the next file. When selected, I like to start the NSURLSession again to upload…
Bart Schoon
  • 299
  • 5
  • 11
1
vote
1 answer

NSURLSessionConfiguration always return nil

I'm trying to access an instance of NSURLSessionConfiguration I've tried following statements to retrieve instance of NSURLSessionConfiguration. Statement 1. NSURLSessionConfiguration *aConfig = [NSURLSessionConfiguration…
sagarkothari
  • 24,520
  • 50
  • 165
  • 235
0
votes
0 answers

URLSession background uploadTask is slow on cellular

I am uploading a file using uploadTask created on a single background URLSession. This is working fine on WiFi, but the uploads are really slow on Cellular data. This is how I am creating the URLSession var configuration =…
0
votes
0 answers

Got error when trying to upload multiple images to server using URLSession Background Session

I am uploading multiple images to server using URLSession. I am using uploadTask(with: request, fromFile: URL(fileURLWithPath: path)). While uploading i got below error every time when i am trying to upload more than 10 images. Everything goes fine…
0
votes
1 answer

NSURLSessionConfiguration and timeoutIntervalForResource for NSURLSessionDelegate didCompleteWithError

Wondering if someone can provide their two cents. Below code successfully triggers didCompleteWithError NSURLSessionDelegate method upon timeoutIntervalForResource timeout. NSURLSessionConfiguration *config = [NSURLSessionConfiguration…
0
votes
1 answer

Delegate Methods for URLSession streamTask Not Called

I'm trying to establish a persistent connection with an IMAP server so that whenever the server sends something over the stream, my app will be notified and be able to respond accordingly. Here is what I have set up so far: class Mailer: NSObject,…
Clifton Labrum
  • 13,053
  • 9
  • 65
  • 128
0
votes
1 answer

NSUrlSession reset(completionHandler:)

What happens to the current tasks present in the session when we do reset(completionHandler:) on UrlSession. Also if it cancels the current tasks then how do we wait for the completion of the current tasks before calling reset(completionHandler:)
mango
  • 9
  • 2
0
votes
0 answers

NSURLSessionConfiguration and NSData always returning nil

I am new to Mac application development and i am working on fixing the deprecation issues present in the application. I am using XCode 11.3 in Mojave MacOS 10.14 and Our application contains the following line of code [NSURLConnection…
0
votes
1 answer

Track percentage download of .SCN file

I am new to ARKIT and I was just wondering is there a way to track the percentage progress of the download of the .SCN file. I have tried using URL session but I couldn't get it to work. Although my code is working well, if my code is completely off…
0
votes
3 answers

Check if Internet access is available

In my app I want to make a network call only if I can access the internet. Note: I'm connected to a WiFi spot that doesn't have Internet I want to test if Internet is available. I tried using Reachability as described here and I also tried a simpler…