Check if Desktop/Documents are synchronised to iCloud

How can I check if Desktop/Documents are synchronised to iCloud? This makes my app super slow and I want to show a warning.

I do not know why I have this irrational fear of creating a new Apple ID and testing on one of my computers.

Probably because it’s darn near impossible to turn off once you’ve turned it on.

1 Like

I can help you with declares for macOS… if these seem to suit your needs.

According to ChatGPT you should also be able to look for the presence of the com.apple.cloud attribute on the folders themselves which you can do with declares or with a shell call.

Thanks, I already have this check for files in iCloud drive:

Dim theURL As New NSURLMBS(theFolderitem)

dim value as Variant 
dim error as NSErrorMBS
Dim result As Boolean = theURL.getResourceValue(value, theURL.NSURLIsUbiquitousItemKey, error)
#Pragma Unused result

If error <> Nil Then
  Globals.theErrorLog.DialogErrorProceed(kErrorCloud.Replace(theFolderitem.DisplayPathMBS, "<<filename>>") + " " + error.LocalizedDescription)
  Return false
End If

Synching to iCloud is something different I think. I checked that in a Zoom call with a user. There was no warning for iCloud visible.

1 Like

Well, ubiquitous items are the name Apple uses for items that are either there or not there with a proxy file in their stead so you can save disk space. I suspect the slowness that you’re experiencing is that accessing one of the offloaded files causes it to download to the user’s computer so it can be inspected?

No. The slowness comes from uploading a big database to iCloud before something else can be written. For PDF files the upload can be done in the background but not for an open database.

you can switch it off easily… you only risk to see all your documents disappear …

1 Like

I experienced many problem when my database is located inside a synchronised folder such iCloud, DropBox, OneDrive or other. Slowdown, corruption, … I wonder if this is the right way to do it. I think it’s better to place the database outside when it is in use.

For example making a backup in an outside folder and, in a next step, send the backup inside the synchronised folder (to test : in the main thread or secondary or with a helper ?).

I’m not a database expert. I’m curious to know if others have a different opinion.

I’m of the opinion, when your app relies on a SQLite database or any special “proprietary” file you create (XML, JSON, etc.) to support your app - I always have the app save them to the SpecialFolder.ApplicationData location. I don’t give the user a choice.

Then… if the user wants a copy for backup purposes or to move the data to another Mac, provide export/import features and the user can decide if they want to save to iCloud. That way, the file is only being written or read once to and from iCloud.

The same goes if your app supports multiple “project” files or folders (for whatever reason), have the app save them to SpecialFolder.ApplicationData where there is no permission or sync issues. And again, export/import from there…

But that’s just me :crazy_face:

Yes, exactly. But many users don’t know that Documents/Desktop synching is on. Therefore, I want to show a warning.

I’m not looking for a declare. The files must be somewhere on the computer. Like Library/iCloud something. Could someone check the location of the files?

I’ve seen databases up to 300 GB for my app. One of the reasons users buy my app is to free space on the main hard disk.

Yikes! Now that is a challenge.

I did see this property recently, don’t know if it helps to indicate when to show a warning: FolderItem.IsUbiquitousItemMBS

Then there is the other NSFileCoordinator and NSFilePresenter classes.