Followed the exact steps from here
My code
func save() {
do {
if let containerUrl = FileManager.default.url(forUbiquityContainerIdentifier: nil)?.appendingPathComponent("Documents") {
if !FileManager.default.fileExists(atPath: containerUrl.path, isDirectory: nil) {
do {
try FileManager.default.createDirectory(at: containerUrl, withIntermediateDirectories: true, attributes: nil)
} catch {
print(error.localizedDescription)
}
}
let fileURL = containerUrl.appendingPathComponent("test2.txt")
if FileManager.default.fileExists(atPath: fileURL.path, isDirectory: nil) {
try FileManager.default.removeItem(at: fileURL)
}
try data.write(to: fileURL)
print("Drawing saved to \(fileURL)")
}
} catch {
print("Error saving drawing: \(error)")
}
}
my info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>UISupportsDocumentBrowser</key>
<true/>
<key>NSUbiquitousContainers</key>
<dict>
<key>iCloud.com.mycompany.TestSketchSave</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>TestSketchSave</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>Any</string>
</dict>
</dict>
</dict>
</plist>
iCloud container id is iCloud.com.mycompany.TestSketchSave
, app id is com.mycompany.TestSketchSave
Files successfully shows up in iCloud Drive settings
According to the post's answer I have also upgraded the version number of the app.
Still does not show in the File app