Understanding iCloud Sync issues

There are a number of posts on the forum about data loss when using iCloud. I’m using iCloud, and mostly it works fine, and if both devices are connected, I can go back and forth between devices and edit my notes, with very smooth updates across devices. But I have noticed that when conflicts do occur – pretty much always because a note is edited either on iPhone or Mac when not connected to the network – one version silently overwrites the other.

I have discovered, however, that the other version is not lost. It is hanging around in iCloud, it is just that Obsidian does not detect the conflict. But when the file is opened in TextEdit, the iCloud conflict resolution dialog is triggered.

This can be reproduced reliably:

  • Create a file, called ConflictTest.md in your vault, which is synced with iCloud
  • Make sure it syncs to iPhone and Mac
  • Put iPhone in airplane mode
  • Edit on both devices
  • Reconnect iPhone and view file in Obsidian on both devices
  • One of the versions will overwrite the other silently
  • Editing can go on without any seeming error (except that one of the additions is not present)
  • Then, open the file in TextEdit:

open -a TextEdit ConflictTest.md

  • Now, the conflict resolution window does get triggered, with the option to keep both versions:

  • Check both boxes and then chlick “Keep Both”
  • The previously lost file will appear with the name ConflictTest 2.md

Why posting this?

First off, from the above it seems clear that there is a possible solution that could make syncing on iCloud much more robust. Namely, by implementing the iCloud sync hook (which obviously is implemented in TextEdit) natively in Obsidian. I do understand why that would not be a priority, given that there is a native sync option, but it is worth mentioning.

Second, this may be useful for others. My guess is that a number of people who have posted about lost data would be able to recover it by opening the relevant note in TextEdit and electing to keep both versions.

Third, the solution to open the file in TextPad works well if you discover that a conflict occurred (because you notice the missing text). However, seeing that Obsidian will happily continue to work on conflicted files, I started thinking that perhaps I have silent conflicts in my notes that I am not aware of. I could of course open every single note in TextEdit, and that would uncover any silent conflicts, but that would be a royal hassle. Even with a script, I would get hundreds of TextEdit windows that I would then need to close. It would maybe be possible to do this as a one-off, but definitely not as part of a regular maintenance routine.

So I am throwing out the question of whether anyone is aware of another way to trigger iCloud conflict resolution from the command line. Something that can be called on each note file and would exit silently if there were no conflicts, but throw a big fat error if there was a conflict – in which case I could do the conflict resolution manually using TextEdit.

Fourth, I wonder if this info leads anyone else to have good ideas about how to make Obsidian with iCloud sync more robust?

2 Likes