Questions tagged [nsurlsession]

NSURLSession is the API for HTTP connections introduced in iOS 7 and OS X 10.9.

The class NSURLSession was introduced to Apple's Foundation.framework in iOS 7 and OS X 10.9.

A NSURLSession object can be considered a group of related data transfer tasks. A response may be received and can be handled via a block statement or delegate methods. NSURLSession provides status and progress properties, of which support canceling, resuming, or suspending tasks, and resuming suspended, canceled, or failed downloads.


Types of Sessions

NSURLSession can support three different types of sessions, which is determined by the configuration object used to initialize the session object.

  • Default Sessions
  • Ephemeral Sessions
  • Background Sessions

Types of Tasks

There are three types of tasks, the last two (Download & Upload) of which support background use.

  • Data Tasks - Send and receive data via a NSData object
  • Download Tasks - Retrieves data in the form of a file
  • Upload Tasks - Sends data, most typically in the form of a file

Related tags to explore:

Adapted from Apple's URL Loading System Programming Guide > NSURLSession.

2479 questions
1
vote
0 answers

Handling Memory Pressure While downloading multiple files in Background using NSURLSession

Im downloading video files of 50-60MB[Around 40-50] in Background using NSURLSession.Sometimes I am getting a Low memory message and app crashes and I cannot access any applications.Is there a way to handle this issue?
1
vote
0 answers

NSURLSession - Random crashes

I am trying to download 100 file in background using NSURLSession. (Modified Apple's sample code - SimpleBackgroundTransfer). In iPhone i am getting the following logs nsnetworkd[298] : Canceling SSDownload: :…
Nibin V
  • 474
  • 6
  • 24
1
vote
0 answers

Resuming Download after WiFi failure while the app is in background using NSURLSession?

I have seen many posts discussing about WiFi loss in the background the background,But still can't find any workarounds.I'm using NSURLSession to download a set of files in background.The issue is when WiFi goes off the downloads are cancelled.Is…
1
vote
0 answers

Downloading Multiple Files in background Using NSURLSession

I have implemented a catalog app(iOS7) which contains a set of videos showcasing the products.In my app i have provided a feature that allows user to download all the videos by enabling it.It starts the download process when app goes in…
1
vote
0 answers

Right way to handle user session with IOS NSURLSession

Hi I am beginner to IOS development. I am developing small IOS application. Required functionality of that application is like this. Application have login for user. once your logged in it will not ask for login again until user do logout. I…
nilkash
  • 7,408
  • 32
  • 99
  • 176
1
vote
1 answer

Is there a 'trick' for sending raw NSString rather than NSData in a NSURLSession connection?

I'm attempting to communicate with a backend using NSURLSession, however, the backend wasn't set up to properly read NSData, so it views the NSData login details I send over as false, I wanna know if its possible to get NSURLSession to send raw…
Josh
  • 225
  • 2
  • 14
1
vote
1 answer

NSURLSession Helper Class

I'm working now on my first really big app to a client. This app will have a server communication and data download/upload. I want to create a good server communication design at the beginning so i wouldn't have to change it a lot when it hits some…
YYfim
  • 1,402
  • 1
  • 9
  • 24
1
vote
0 answers

No data receiving with NSURLSession

My post request works fine (I have a good response and no error) but I have no data receiving too.. Normally when I am on my browser on this site https://conventiondestage.insa-toulouse.fr/index.php I complete the form and after login I can see the…
Gautier
  • 47
  • 1
  • 13
1
vote
2 answers

Is it possible to subclass NSURLSessionDownloadTask to create a dedicated API for a service?

Say I want to create an easy way to download an image from Imgur. I do it frequently enough within my app that it'd be nice to not have to go through all of the setup for a NSURLSessionDownloadTask and configuring it for this use-case, and instead I…
Doug Smith
  • 29,668
  • 57
  • 204
  • 388
1
vote
1 answer

Clearing temp download files after Network Failure using NSURLSession

I'm using NSURLSession to download a list of files in my app.I have support for background downloading and is working correctly.But some times when the WiFi connectivity is lost while the app is in background,some files remain in the temp…
1
vote
2 answers

HTTPMaximumConnectionsPerHost is ignored in AFHTTPSessionManager

I am trying to use AFNetworking2.0 with new NSURLSession class to fetch some data. In particular I am interested in new HTTPMaximumConnectionsPerHost property of NSURLSessionConfiguration but unfortunately it doesn't seem to work as I…
user1264176
  • 1,118
  • 1
  • 9
  • 26
1
vote
0 answers

NSNetwork error after starting NSURLSessionDownloadTask

I use NSURLSession to download files in background. Here is how I start a new NSURLSessionDownloadTask: NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[self nextURL]]; _task = [[self downloadSession]…
1
vote
0 answers

iOS uploading assets library images and photos to a server in the background

I'm having difficulty by uploading to a server from iOS assets library. Successfully I managed to get the photos datas and store them in an array, however I cannot managed to send them to the server in a best way. I tried the NSOperationQueues,…
1
vote
2 answers

advice to manage properly NSURLSession

i begin to developp an iphone application and i need some advice about the NSURLSession and about how to manage properly the download and parsing of my data. i just finish to correct a bug for the download of my data in a nsurlsession, but regarding…
George
  • 332
  • 1
  • 4
  • 16
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…