I want to remove a file. For it, I have the url
. Its url.absoluteString
is:
file:///private/var/mobile/Containers/Shared/AppGroup/UUID/Library/Caches/someLocation/CexRlA-L:2258
The file exists because
FileManager.default.fileExists(atPath: url.path) == true
But doing
try FileManager.default.removeItem(at: url)
fails with error:
Failed to remove "CexRlA-L/2258"
FileManager changes the :
in the filename (CexRlA-L:2258
) to /
. So CexRlA-L
becomes treated as a folder and it of course does not exist.
I have not managed to reproduce locally, but it happens often to our users. Any pointers on what may be going on?
Thanks in advance.