Closed dfcarney closed 11 years ago
Hey David, glad you're enjoying the project. To prevent TICDS from synchronizing you can return NO
from the TICDSDocumentSyncManagerDelegate
method:
/** Invoked to ask the delegate whether the document sync manager should initiate Synchronization automatically after finishing processing changes in a synchronized managed object context.
@param aSyncManager The document sync manager object that sent the message.
@param aMoc The managed object context that saved.
@return `YES` if the document sync manager should initiate the upload, otherwise `NO`. */
- (BOOL)documentSyncManager:(TICDSDocumentSyncManager *)aSyncManager shouldBeginSynchronizingAfterManagedObjectContextDidSave:(NSManagedObjectContext *)aMoc;
It is not possible at this point to exclude some attributes from synchronization in the manner you're describing, unfortunately.
We actually use a similar technique that you're describing in MoneyWell to prevent the remote files from being vacuumed unless Wi-Fi is available:
- (BOOL)documentSyncManagerShouldVacuumUnneededRemoteFilesAfterDocumentRegistration:(TICDSDocumentSyncManager *)aSyncManager
{
if ([[TNMReachability reachabilityWithHostname:kDBDropboxAPIHost] isReachableViaWiFi] == NO) {
return NO;
}
Thanks for the informative replies; I'll incorporate your answers into my project. Incidentally, I also added a Reachability callback that cancels an existing synchronization if Wifi disappears for more than a few seconds (and, similarly, initiates a new one when Wifi is restored).
I've got another question, which I'll post separately.
Thanks for all your work on TICoreDataSync; it's a great project.
I'm aiming to use TICDS in an app with a CoreData model that includes an external record file for some large NSData blobs. I want to prevent these objects from being synced unless a wifi connection is available. As far as I can tell, it's not currently possible to explicitly pause and resume synchronizations. I was consider hacking things to just block in various delegate callbacks if Reachability status isn't Wifi, but that's just evil.
Do you have any recommendations on how to implement pause/resume support?
Alternatively, is it possible to exclude some objects (or attributes) as part of a synchronization? I.e. could I exclude NSData attributes (marking them as a pseudo-fault) that TICDS recognizes their containing objects as being partially synchronized (such that large NSData blobs are only synchronized once wifi access becomes available)?