Reputation: 777
I am trying to accomplish the following:
I have this set to create the documents directory.
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
if let iCloudDocumentsURL = FileManager.default.url(forUbiquityContainerIdentifier: nil)?.appendingPathComponent("Documents") {
if (!FileManager.default.fileExists(atPath: iCloudDocumentsURL.path, isDirectory: nil)) {
do {
try FileManager.default.createDirectory(at: iCloudDocumentsURL, withIntermediateDirectories: true, attributes: nil)
print("Created Directory at \(iCloudDocumentsURL)")
} catch {
print("Error Creating Directory: \(error)")
}
}
print("\(#function):\(#line) iCloudDocumentsURL =\n\(iCloudDocumentsURL)")
self.iCloudDocumentsURL = iCloudDocumentsURL
}
I have the entitlements turned on and a plist entry as follows:
<dict>
<key>iCloud.com.mycompany.SubLunch</key>
<dict>
<key>NSUbiquitousContainerIsDocumentScopePublic</key>
<true/>
<key>NSUbiquitousContainerName</key>
<string>SubLunch</string>
<key>NSUbiquitousContainerSupportedFolderLevels</key>
<string>One</string>
</dict>
I can see the file is getting written here:
file:///private/var/mobile/Library/Mobile%20Documents/iCloud~com~mycompany~SubLunch/Documents/LRA%20Order%20Detail%20Results.csv
But nothing changes on my iCloud Drive on my Mac.
I have used brctl log --wait --shorten
to view activity and I can see output.
What am I doing wrong here?
Thanks in advance
Upvotes: 0
Views: 616
Reputation: 777
I found the answer, you need to export to server the file once you're done modifying it. Then you will get the document picker to allow you to pick where to store it in iCould Drive.
Upvotes: 0