Re: 'Global' NSURLCache?
Re: 'Global' NSURLCache?
- Subject: Re: 'Global' NSURLCache?
- From: email@hidden
- Date: Tue, 28 Nov 2017 22:48:12 -0500
> On Oct 31, 2017, at 4:29 AM, Quinn The Eskimo! <email@hidden> wrote:
>
> If you want to share a cache between processes you may be able to do that by
> having them both initialise an NSURLCache instance to point to the same place
> on disk (using `-initWithMemoryCapacity:diskCapacity:diskPath:`). I /think/
> that’ll work but I haven’t looked into it in detail so I’m not 100% sure.
I've set this up for our app that uses a group container, where the main app
and a helper app both use the same custom NSURLCache, and it does work (adding
a cached response from the helper app makes it available to the main app)
#thumbsup!
I did run into a bit of a snag however.
When adding a cached response to the NSURLCache, a NSURLRequest must be used;
my code that sets up the request (shared code between apps) adds a User-Agent
header which specifies the current process app name, and build version/number.
This is mostly for metrics on our server, among other things.
As you probably guessed by now, the request generated by the helper app to
create the cached response will have a different User-Agent header than the
request created by the main app; this mismatch of the header prevents the main
app from being able to fetch the cached response the helper app added, unless I
omit that header altogether (which I'd like to avoid having to do).
Is there a way to specify what headers are significant when requesting a cached
response from a NSURLCache?
_______________________________________________
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