I'm using FileManager.default.removeItem to remove videos from local path and that works the videos after removeItem is gone, but the space that the videos used on the device is not released. So after long enough (import/delete videos) my test phone gets filled with data that can't be deleted because it's not there yet it's there.
When i go to settings on the phone where i can se what my app used of space i can se that my app's used data is removed when i delete a video but the general free space is not changed at all.
Here is the code i used to delete a video and related data json data for the video (recordingFileUrl is of type URL for the json and videoUrl is also of type URL for the video):
private let fileManager = FileManager.default
func delete() throws {
autoSave = nil
let dataUrl: URL = recording.id.recordingFileUrl
if fileManager.fileExists(atPath: dataUrl.path) {
try fileManager.removeItem(at: dataUrl)
}
let videoUrl: URL = recording.videoUrl
if fileManager.fileExists(atPath: videoUrl.path) {
try fileManager.removeItem(at: videoUrl)
}
}
If anyone have any ideas why the space is not released on remove(delete) and what to change to make it do i would be very happy thanks.