FileManager.default.removeItem not removing file [duplicate]
This question already has an answer here: Objc save a file to the tmp/ with URL it is not working 1 answer UIImage(contentsOfFile:) returning nil despite file existing in caches directory [duplicate] 1 answer NSURL path vs absoluteString 2 answers I'm trying to remove a file from the documents directory using FileManager.default.removeItem but is not deleting the file on the simulator. Here is my code: if let dir = fileManager.urls(for: .documentDirectory, in: .userDomainMask).first { do{ let path = dir.appendingPathComponent(file).absoluteString do{ try FileManager.default.removeItem(atPath