I am using below code to trash an item
do {
try FileManager.default.trashItem(at: NSURL(fileURLWithPath: "/Users/syamalacat/Downloads/Doc.docx") as URL, resultingItemURL: nil)
} catch {
print(error)
}
I dont see Downloads under xcode application to check the box in Files and Folders in System Preferences pane, but it is just throwing below error
Error Domain=NSCocoaErrorDomain Code=513 "“Doc” couldn’t be moved to the trash because you don’t have permission to access it." UserInfo={NSURL=file:///Users/syamalacat/Downloads/Doc.docx, NSUserStringVariant=(
Trash
), NSUnderlyingError=0x600000c6fed0 {Error Domain=NSOSStatusErrorDomain Code=-5000 "afpAccessDenied: Insufficient access privileges for operation "}}
From Files and Folders , i am not able to add Downloads folder, it is greyed out
Even for the first time i am not able to see user consent message
Note: I am running my application from xcode itself