Since the release of the first beta of macOS Monterey, I've got an issue while listing the content of the Trash.
I've got a sandboxed app with User Selected File entitlement, I select my User Home folder in an Open dialog box, then I try to list the content of the Trash, but it's empty (whereas it's not!). Even with Full Disk Access given, the content is still empty.
if let trashURL = try? FileManager.default.url(for: FileManager.SearchPathDirectory.trashDirectory, in: .userDomainMask, appropriateFor: nil, create: false) {
if let content = try? FileManager.default.contentsOfDirectory(at: trashURL, includingPropertiesForKeys: nil, options: []) {
print(content)
}
}
It was working fine in macOS Big Sur. Getting Full Disk Access was sufficient to list the content of the Trash.
Is there any change?