Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Forcing or "encouraging" iCloud to upload changes to a file

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.

like image 797
Craig Otis Avatar asked Nov 13 '13 14:11

Craig Otis


Video Answer


2 Answers

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

like image 63
Marcin Avatar answered Oct 19 '22 15:10

Marcin


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!

like image 1
coolcool1994 Avatar answered Oct 19 '22 15:10

coolcool1994