You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I first clic on the load button, the request is sent to the server, and the logs are the following :
dataTask:didReceive response
data = 129408 bytes
When I clic a second time, the request is not sent to the server, the cached image is used and the logs are the same.
We can note that the log print("session:willCacheResponse:") is never called even it should be.
The cache folder structure is :
Note the duplication of the Cache.db files. What's more the fsCachedData folder, that contains the cached image, is at the wrong location. That means the image is saved in the default URLCache and not in the custom one I defined in my sesssion.
Without DBDebugToolKit activated
If I trash the app and remove the line DBDebugToolkit.setup() in the AppDelegate, when I first clic on the image, the request is sent to the server and the logs are the following:
dataTask:didReceive response
data = 16384 bytes
data = 16384 bytes
data = 16384 bytes
data = 16383 bytes
data = 16384 bytes
data = 16384 bytes
data = 16384 bytes
data = 14721 bytes
session:willCacheResponse:
Note that this time the logs are correct and session:willCacheResponse: is printed !
The cache folder structure is
This time there is only one Cache.db file, and the fsCachedData folder is under the com.xxxxx.yyyyy directory. Which is the expected behavior.
Issue
So the issue is that a custom url session with a custom url cache is never taken into account with DBDebugToolkit activated. What's more the URLSessionDataDelegate method urlSession(_:, dataTask:, willCacheResponse:, completionHandler:) is not called.
The text was updated successfully, but these errors were encountered:
Sorry this is currently not solved. This is an bigger problem of this tool how the request will be currently logged/stored. But i hope this can be fixed in the near future with an refactoring.
There is a weird bug related to custom
URLSession
andURLCache
.Project setup
Here is my
AppDelegate
that enablesDBDebugToolkit
.In my
ViewController
, I have a button that loads an url withCache-Control
header set, meaning the system should cache the response.With DBDebugToolKit activated
When I first clic on the load button, the request is sent to the server, and the logs are the following :
When I clic a second time, the request is not sent to the server, the cached image is used and the logs are the same.
We can note that the log
print("session:willCacheResponse:")
is never called even it should be.The cache folder structure is :
Note the duplication of the
Cache.db
files. What's more thefsCachedData
folder, that contains the cached image, is at the wrong location. That means the image is saved in the defaultURLCache
and not in the custom one I defined in my sesssion.Without DBDebugToolKit activated
If I trash the app and remove the line
DBDebugToolkit.setup()
in theAppDelegate
, when I first clic on the image, the request is sent to the server and the logs are the following:Note that this time the logs are correct and
session:willCacheResponse:
is printed !The cache folder structure is
This time there is only one
Cache.db
file, and thefsCachedData
folder is under thecom.xxxxx.yyyyy
directory. Which is the expected behavior.Issue
So the issue is that a custom url session with a custom url cache is never taken into account with
DBDebugToolkit
activated. What's more theURLSessionDataDelegate
methodurlSession(_:, dataTask:, willCacheResponse:, completionHandler:)
is not called.The text was updated successfully, but these errors were encountered: