I am using the following code to read the content of a text file.
let str = try! String(contentsOfFile:"/Users/my/Desktop/a.txt")
It works well until I upgraded my Xcode to 9.1 version and this line of code made the app crashed. The error is :
Error Domain=NSCocoaErrorDomain Code=257 "The file a.txt” couldn’t be opened because you don’t have permission to view it."
How can I get the permission to read the file?