16

I have a Mac and iOS application that is sharing data using iCloud, via a single "shoebox" file.

Most of the time, changes are properly synchronized in an efficient and prompt manner. However, every once in a while (particularly, right now) changes that I make on one device simply sit there.

I have made changes on my Mac to the shared data file, and the data has been saved to disk. However, I don't know whether it's the system's failure to upload the data to iCloud, or the iOS device's failure to check for the new data, but I'm twiddling my thumbs.

iCloud Status on Phone

The 5KB file below is the one that should be changing. No matter how many changes I make in the Mac app, every once in a while during testing, iCloud will just stop syncing changes. If I walk away for 20 minutes and come back, it might start up again.

Further: If I run the Mac application in Xcode and keep an eye on the same file, even though I make changes to the file and can confirm that the file on disk (in the Finder/Terminal) is actually changing, the iCloud panel in Xcode does not pick up these changes very quickly either:

iCloud Status on Mac

Note the same 5KB file has changed on my local filesystem on my Mac (at 9:01), but iCloud just isn't picking it up. There are actual content changes in this file, not just a modification date change.

So, I would like to find a way to either:

  1. Trigger the sync programmatically, or even using Xcode. I know that the iCloud sync can be triggered using the simulator, but this only works when testing on iOS, and I much prefer to do my testing on the actual hardware anyway. Or,

  2. Determine who (or what) is "at fault" for the data not being shared. I have followed the iCloud documents from the beginning, ensuring that I'm using coordinated writes to save changes, etc. It's just a very intermittent thing where iCloud will doze off, and makes testing very frustrating.

Craig Otis
  • 31,257
  • 32
  • 136
  • 234
  • 5
    There's no "sync now" API. It just works, except when it doesn't. But you can at least resolve the question of whether the changes were uploaded by using https://developer.icloud.com to see what iCloud thinks the file looks like. – Tom Harrington Nov 15 '13 at 21:46
  • 1
    Ah - that link is extremely helpful! I ran a few tests with two iPhones - both devices are indeed pushing changes up to the cloud, but only one is successfully being notified, and pulling them down. (Even though they're both running the exact same build of the same app.) Womp womp! – Craig Otis Nov 15 '13 at 22:05
  • If it makes you feel any better (it won’t) I have observed the same inactivity with Apple applications. Pages, for example, may or may not sync immediately (I’ve seen it take several minutes). When I go to the Mac I will see my old text then, after a few minutes, it “automagically” updates. This can be pretty scary when you have a 100,000 word document. – Lloyd Sargent Jan 17 '16 at 19:00

2 Answers2

1

I don't think you can trigger synchronization of selected files, but you can use this tool "brctl" to see what is going on under the hood (or diagnose) (on OSX), to diagnose what it might be about.

commant line command:

$ brctl

for example use it like this

brctl log --wait --shorten

or brctl diagnose

Marcin
  • 3,694
  • 5
  • 32
  • 52
1

I realized when you migrate any store to your existing iCloud store, the iCloud store adds those data and forces sync to the version in the iCloud. So I migrate an empty store to my existing iCloud store, and I forced the sync!

coolcool1994
  • 3,704
  • 4
  • 39
  • 43