Re: Does a background NSURLSesssion not populate the provided NSURLCache?
Re: Does a background NSURLSesssion not populate the provided NSURLCache?
- Subject: Re: Does a background NSURLSesssion not populate the provided NSURLCache?
- From: "Quinn \"The Eskimo!\"" <email@hidden>
- Date: Wed, 23 May 2018 07:40:36 +0100
On 22 May 2018, at 20:52, Sebastien Boisvert <email@hidden>
wrote:
> Do background sessions ignore the cache (with regards to populating it)?
Probably. While I’ve never explicitly investigated this, the background
session architecture, where the actual networking is done inside a system
process, isn’t compatible with custom caching.
Note that the ‘will cache response’ delegate callback takes a data task, and
data tasks have only limited support in background sessions. Specifically, you
can run a data task in a background session but it will fail if your app gets
suspended [1]. Honestly, it’s quite rare to use a data task in a background
session.
Which brings me to:
> I have a need to make several requests for (small) resources …
Background sessions are optimised for a small number of large requests, making
me suspect you’d be better off using a standard session. Why are you using a
background session here?
Share and Enjoy
--
Quinn "The Eskimo!" <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
[1] This is on iOS 8 and later. In the original iOS 7 implementation, data
tasks were simply not supported in background sessions.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Macnetworkprog mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden