FileManager.default.trashItem(at:resultingItemURL:) doesn't update trash icon to be full for some devices

A user of my app noticed that when using it to move a file to the trash on an USB drive, the trash doesn't show the file until unmounting the drive and mounting it again. I was able to reproduce it with one of my own USB drives, but with another USB drive it doesn't reproduce. All USB drives are formatted APFS.

When moving a file to the trash from the Finder, both USB drives immediately list it in the trash. Is this a macOS bug, or am I doing something wrong?

I created FB19941168.

let openPanel = NSOpenPanel()
openPanel.runModal()
let url = openPanel.urls[0]
do {
    var result: NSURL?
    try FileManager.default.trashItem(at: url, resultingItemURL: &result)
    print(result as Any)
} catch {
    fatalError(error.localizedDescription)
}
Answered by DTS Engineer in 855800022
I created FB19941168.

Thanks. That’s the best path forward here.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

I created FB19941168.

Thanks. That’s the best path forward here.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

FileManager.default.trashItem(at:resultingItemURL:) doesn't update trash icon to be full for some devices
 
 
Q