I have pretty basic function for testing purposes to save a text file to File.app
, but the created text file does not ever appear in the File.app.
func saveDocToFiles() {
let file = "DummyFile.txt"
let contents = "some text"
let resourceDocPath = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first! //replace with if let
let fileURL = resourceDocPath.appendingPathComponent(file)
do {
try contents.write(to: fileURL, atomically: true, encoding: .utf8)
print("successfully saved - document library \(self.getDocumentsDirectory())")
} catch {
print("oh no could not be saved")
}
}
I've added both keys below:
Application supports iTunes file sharing
Supports opening documents in place
While using a simulator if I browse to the document library the file is created. I've tested this on an actual device and the behavior is the same.
Am I missing a configuration for the file to appear in File.app
?