DEV Community

Discussion on: iOS: Saving files into user’s iCloud Drive using FileManager

 
usb profile image
Umayanga Alahakoon

Yeah, the same iCloud account and I'm not doing backup.
I have no idea what causes this problem.

I'll try something with CloudKit.
Thanks for the reply. Have a great day.

Thread Thread
 
usb profile image
Umayanga Alahakoon

My app's folder doesn't show up inside iCloud Drive in iOS files app. I think this might be the problem.

I've correctly specified the .appendingPathComponent("Documents") part and I can even see all of my saved images via Settings->Account->iCloud->Manage Storage->AppName

This is how I save images to the iCloud Drive

// "imgData" is the jpeg data of an image

let driveURL = FileManager.default.url(forUbiquityContainerIdentifier: nil)?.appendingPathComponent("Documents")

let filePath = driveURL!.appendingPathComponent( <unique-name-of-the-image> )

try imgData.write(to: filePath)

Do you have any clue on what's wrong with my app? (especially on the app's folder doesn't show up inside iCloud Drive)

Thread Thread
 
nemecek_f profile image
Filip Němeček

Did you try bumping up the app and build numbers?

Thread Thread
 
usb profile image
Umayanga Alahakoon

Yeah, but still doesn't work. Anyway, thanks too much for replying me. Have a nice weekend.

Thread Thread
 
nemecek_f profile image
Filip Němeček

Strange, one last thing that occured to me.. What language is your device? Maybe "Documents" works only for English? Which would be crazy but who knows..

Thread Thread
 
usb profile image
Umayanga Alahakoon

It’s English (US)

Thread Thread
 
boxed profile image
Anders Hovmöller

I have the same problem. I do everything in this article, but no folder appears. I tried to add a createDirectory call too, but no dice.

Thread Thread
 
boxed profile image
Anders Hovmöller

Well crap. In my case if I just created a file in the folder it appeared! So seems different from your case.