Saving/Reading files on iCloud Drive (question)

Instead of using SpcialFolder.ApplicationData as my gateway to saving and loading files, I thought it would be a good idea to use iCloud Drive so that I would have the same files available on my Mac laptop and my desktop Mac.

I tried substituting SpcialFolder.ApplicationData with “iCloud Drive” but that doesn’t work. How do I go about it?

iCloud is deep in the bowels of macOS.

Any cloud that does synchronisation between computers will f.u.c.k up your data sooner or later. Especially, iCloud is not a good idea. Also with iCloud you need to test if the file is there, not there or could be there. The last option is called IsUbiquitous and you can do the check with MBS plugin or AppKit from Ohanaware.

I suppose I must accept what you say but I can’t really understand the problem. I save and open files on iCloud all the time using my laptop and my iMac and they are always there and not causing any problems. In fact all my Xojo projects are in a folder on iCloud and I can open them and run them on either of my machines so it seems absurd to keep different sets of my own Xojo app data locally on the two machines.

In fact it caused me some confusion today because I thought I had ironed out a bug in my current project working on my iMac, saved as one project on iCloud, but the problem seemed to be still there when I ran it on my laptop until I remembered that I was using a different set of my own data files and this was what was throwing a spanner in the works.

Please search the forum for problems with saving Xojo files on iCloud.

If a file on iCloud has been evicted then the folderitem.exists check fails and you could overwrite a file. This also was discussed here a the forum when a dev wondered why his users reported missing files.

iCloud is an abomination.
It ‘solves’ the problem Apple cause by having drives that are too small, by keeping files on their servers ‘until needed’
Use too much and you start paying them.
Turn it off, and it erases all documents from your machine without asking.
I lost weeks due to that once, and will never fall for that again.
Now, I dont have any synchronisation turned on.
I still have iCloud, but I copy things there manually as one form of backup

MacOS uploads and downloads files in the background while pretending they are all local for you.

If you want to do the same , the process is horrible.
MBS plugins have an example project I haven’t been able to get working yet.

A simple API that looks like

iCloudPullFile(trgtLocalFile, fileURL)
iCloudPushFile(srcLocalfile, fileURL)

would be spiffing.

(If drives were larger and iCloud worked like Time Machine, I’d be much happier.)

OK that sounds really worrying. I pay something like 75pence a month for iCloud as I don’t save photographs, movies or music there, but I do store TextEdit and Xojo projects so I had better start thinking of it as a backup.Thank you both for the warning.