The file “xxx” couldn’t be opened because there is no such file [duplicate]
问题 This question already has answers here : UIImage(contentsOfFile:) returning nil despite file existing in caches directory [duplicate] (1 answer) NSFileManager.defaultManager().fileExistsAtPath returns false instead of true (2 answers) Closed 3 years ago . I would like to open a .txt file and save the content as a String. I tried this: let path = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0].appendingPathComponent("xxx.txt") var contentString = try String