Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iCloud] How to pause/resume the auto-sync mechanism and keep generating sync change files? #56

Open
xsown opened this issue May 30, 2013 · 4 comments

Comments

@xsown
Copy link

xsown commented May 30, 2013

I am using the iCloud branch of TICDS in my project. I found that the TICDSFileManagerBasedDocumentSyncManager has 2 methods [beginPollingRemoteStorageForChanges] and [stopPollingRemoteStorageForChanges], while the TICDSiCloudBasedDocumentSyncManager has only [enableAutomaticSynchronizationAfterChangesDetectedFromOtherClients]. I'm trying to provide a wifi-only sync feature, as the syncing mechanism will automaticlly paused when the network is switching to WWAN or completely shutdown (airplane mode, etc), but I want to preserve the app sync manager and doc sync manager configured to keep generating sync change files for future syncing. So the questions are:

  1. how can i stop the watching(polling) function on TICDSiCloudBasedDocumentSyncManager after calling [enableAutomaticSynchronizationAfterChangesDetectedFromOtherClients]?
  2. the [deregisterDocumentSyncManager] of TICDSDocumentSyncManager will set the documentIdentifier and many other properties to nil, so I should not call [registerConfiguredDocumentSyncManager] to re-register, right? Shall I configure the document sync manager again?

Thank you!

@chbeer
Copy link
Contributor

chbeer commented May 30, 2013

The iCloud syncing is based on the file syncing mechanisms provided by iOS. You can't pause that one.
The iCloud syncing works like the file syncing as it only produces files in a certain directory. Besides that it only uses the NSMetadataQuery (in TIUbiquityMonitor) for checking if files have changed and need to be loaded (only needed on iOS as iOS doesn't load files automatically).

So, TL;DR: you don't need to pause anything when using iCloud sync. You can however deactivate the TIUbiquityMonitor. (I am planing to include the functionality of that class into the TICDSiCloudDocumentManager).

@xsown
Copy link
Author

xsown commented May 30, 2013

Thanks for your reply :)

  1. I've searched the whole project and didn't find any class using or mentioning TIUbiquityMonitor except itself. 
  2. My thought to stop monitoring files is to save the network flow under WWAN for the user. I know I cannot prevent the files coming into the ubiquity container, but can I just leave them as placeholders there and do not start to download them immediately, until the network is switched to WIFI? If it isn't possible to do so, I'll remove the wifi-only sync feature.

@chbeer
Copy link
Contributor

chbeer commented May 30, 2013

1.) Yes, you're right. It's currently not used by the iCloud classes. I start it in my app as soon as the sync starts. And also use it early on a new device with a special NSPredicate to priorize the download of the whole store.

My idea would be to merge the functionality of that class into the TICDSiCloudDocumentManager to replace the directory watcher and use the NSMetadataQuery to identify new files / changes.

2.) There is a switch burried deep down in the iCloud Settings -> Documents and Data that is called (something like) "Use mobile data" (my iPhone is German so I don't know the English name). Isn't that doing what you're thinking about?

@xsown
Copy link
Author

xsown commented May 30, 2013

  1. I know what I should do now, thank you!
  2. I've forgot that setting... ok it is acceptable :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants