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
0
votes
1 answer

How should I deal with cache settings?

I am building a SDK targeted at developers in my corporation, both at the head office and abroad. This SDK is implemented as a Singleton and provides the developers with data objects acquired (when possible) from our corporate servers. I intend to…
Kheldar
  • 5,361
  • 3
  • 34
  • 63
0
votes
1 answer

How to handling more than 1000 api request using NSUrlsession

-(instancetype)initWithDataTaskWithUrlRequest:(NSURLRequest *)request WithIdentifierIndex:(NSString*)identifier { self = [super init]; if (self) { NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration…
0
votes
1 answer

NSURLSessionConfiguration not returning the URLRequest data

I am using the following code to set proxy setting in URLConfiguration. NSString *proxyHost = @"192.168.xx.xxx"; NSNumber *proxyPort = [NSNumber numberWithInteger:8090]; NSString *request = [NSString stringWithFormat: …
Balaji Kondalrayal
  • 1,743
  • 3
  • 19
  • 38
0
votes
1 answer

UI is not updating with NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier

I am downloading hundreds of files with NSURLSessionConfiguration. I am updating a progress label for each downloaded file, from method -(void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask…
0
votes
2 answers

didcompletewitherror return nil even for request with bad url

I have a Nsurlsesiondownloadtask running which I use to download an XML file locally hosted at say : url - http://10.232.254.59/catalogue.xml Problem is when I use url - http://10.232.254.59/catalogue.x or url - http://10.232.254.59/catal or any…
0
votes
2 answers

Alamofire ignores timeoutIntervalForRequest and timeoutIntervalForResource parameters

I am currently trying to decrease the default values for timeoutIntervalForRequest and timeoutIntervalForResource of NSURLSessionConfiguration for every Alamofire remote calls in my iOS app since I don't want it to wait 60 seconds and 7 days…
Aluminum
  • 2,932
  • 5
  • 35
  • 63
0
votes
1 answer

Issues with A background URLSession with identifier

I tried this code in my project to download large files in background and it works fine. I start downloading in UIViewController. If I go to another view and back to the UIViewController ,it stop reloading the progress bar. I got the Issues with A…
0
votes
1 answer

Overriding Proxy in Device Settings for NSURLSessionConfiguration?

Is it possible to ignore the proxy settings that are in the device network settings, and instead use no proxy when using an NSURLSession ? Basically I want to fall back on using no proxy if the connection fails. Thanks !
GuybrushThreepwood
  • 5,598
  • 9
  • 55
  • 113
0
votes
1 answer

For NSURLSessionConfiguration, what is the actual difference background default?

I'm having trouble on an iOS app using NSURLSession to login into a website that uses cookies to record successful authentication. Using the defaultSessionConfiguration() I have no problem. (It even works when the app is in the background and…
andymc
  • 51
  • 7
0
votes
1 answer

AFNetworking file downloading error Error Domain=NSCocoaErrorDomain Code=260

i am using AFNetworking 3.0.4 for a video file downloading and its progress reporting. The file seems to download successfully but when i save this file and try to get the file attributes then it gives me the following error. Error…
0
votes
2 answers

NSURLCache for NSURLSession background tasks

I'm trying to implement caching in my app, I'm using NSURLSession with background configuration for most of my networking needs and it works great but then I'm adding a cache object the session disregards it and always goes to the server I tried to…
Arkadi
  • 51
  • 1
  • 5
0
votes
0 answers

Proxy HTTP in NSURLConnection

I am trying to proxy my requests in a NSURLConnection by using the code below, My problem is that I am getting a strange response from what seems to be the proxy when all I should be getting back is a IP address to show that the proxy is working. …
Charlie
  • 222
  • 3
  • 20
0
votes
1 answer

NSURLSession : setting request time out > 75 Seconds [Server unreachable]

I have an Post Request, that needs to be submit using NSURLSession. Due to some requirement, i have to set the timeout to 230 seconds. So the idea here is, the NSURLSession should wait for 230 seconds until it declares the task as time out issue. I…
0
votes
1 answer

Test that NSURLSessionConfiguration settings are obeyed

I created an NSURLSessionConfiguration with some default settings but when I see the request object made with that configuration in my custom NSURLProtocol it doesn't seem that all those settings are inherited and I'm a bit…
wesshi
  • 231
  • 2
  • 11
0
votes
0 answers

How can I use a variable for assigning an additional header?

I have a variable which holds 3f78124e98419428b7. I want to replace this string with my variable. Does anyone know how can I do this? [config setHTTPAdditionalHeaders:@{@"Authorization":@" Token token=\"3f78124e98419428b7\""}];
Mina
  • 85
  • 1
  • 9
1 2 3
9
10