Closed mkll closed 4 years ago
Hello @mkll!
1.- I think your logic makes sense, somehow the URL session configuration should have been connected to the way caching is handled in Networking. Sadly, it wasn't done that way, instead caching is handled at the call level. Whenever you make a Networking call you can decide the caching level, the default is none.
If I were to make the change now of connecting URL session configuration with how caching is handled I'm worried it might lead to inconsistent behavior, where some people using ephemeral tried to do caching here and there and it wouldn't work.
If caching is none by default and you aren't using any caching I'm surprised why this crash is even happening. Either way, it's something we need to fix.
2.- The fatalError
is not necessary. I'll remove it. If we can't construct the URL in this method we should just escape instead of crashing.
3.- My answer here is similar to the 1st one, even though your logic makes sense I'm afraid it could cause unwanted behavior.
@3lvis thanks for the clarification.
Imagine how surprised I was when I saw this crash for the first time. Whaaat? Caaache? But how? :)
As for me, removing fatalError
seems to be enough to eliminate negative impact. It's just an overkill here.
Fix published in 5.0.3, thanks!
https://github.com/3lvis/Networking/releases/tag/5.0.3
Hi @3lvis ,
I use Networking in an app that is currently under active development, so I run it in the simulator several dozen times a day. 1-2 times a day, the application crashes in the same place for no apparent reason:
I tried to find out exactly which path is formed in those cases when there is no crash, and set a breakpoint. Here is the result:
Hmm, nothing special. Slashes are simply replaced by hyphens. It's ok.
I would like to clarify a few points for myself:
Is it normal that Networking deals with the cache, even though I am instantiating it in ephemeral mode, i.e.:
let networking = Networking(baseURL: baseUrl, configuration: .ephemeral)
Is the
fatalError
really necessary in this place? It relates to deleting data from the cache. Well, really, it's just a cache. iOS will remove it itself if it needs. Is it necessary to crash the app just because the cache path could not be composed? It's especially sad to get a cache-related crash when you don't use the cache at all.Is it possible to completely disable any deal with the disk cache in ephemeral mode? May I, say, override the corresponding method calls?
Thanks.