Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Swift 4 - porting issue

I do not know how to describe this issue. I have a small program importing a zip file from a web site and converting it in a csv format. I wrote it in Swift3 /Xcode9/ MacOS10.13. It works. I did a clean install of my Mac and I now have Swift4/Xcode10/MacOS 10.14. It works if I do not do any change in the program.
But I wanted to make a few changes, and now I get an error "failed reading from URL ..." because the following line of code:
let documentDirectory = NSSearchPathForDirectoriesInDomains(.documentDirectory, .userDomainMask, true)[0]
does not send me back the directory path I expect, i.e : file:///Users/claude/Documents/FD/Lt/lt2017.csv,
but this one
file:///Users/claude/Library/Containers/CMS.Lv40/Data/Documents/FD/Lt/lt2017.csv
I guess it's related to sandboxing, but I have not found any article describing this kind of issue and how to write the proper code. Can someone help?

Comments