So when i run below code , i get Catalina User consent "Your App wants to access Documents folder"
do {
//return [FileAttributeKey : Any]
let attr = try FileManager.default.attributesOfItem(atPath: "/Users/catalina/Documents/Test.docx")
var fileSize = att
r[FileAttributeKey.size] as! UInt64
//if you convert to NSDictionary, you can get file size old way as well.
let dict = attr as NSDictionary
fileSize = dict.fileSize()
} catch {
print("Error: \(error)")
}
Even when i click on Don't allow, still the API returns attributes and API never throws any error. How can i catch the exception here and redirect user to give permissions in System Preferences.