Git Product home page Git Product logo

Comments (4)

Rjonhson avatar Rjonhson commented on July 28, 2024

I ask because added objects before turning sync on will never be synched. Also, I found no way to deregister an already registered applicationSyncManager, so I can never turn sync off. Thank you

from ticoredatasync.

MrRooni avatar MrRooni commented on July 28, 2024

I could use a little more insight into your use case to understand exactly what you'd like to accomplish. If the user has configured syncing already, but wants to pause syncing for some reason, you can return NO from the TICDSDocumentSyncManagerDelegate documentSyncManager:shouldBeginSynchronizingAfterManagedObjectContextDidSave: method. That's one way to "turn off" syncing.

If you'd like to make sure that all sync changes are properly recorded, even if the user has disabled syncing, you can configure a TICDSDocumentSyncManager before you're ready to use it:

/** Configure a document but don't immediately register it.

 Use this method to configure the sync manager in environments where you may not have a permanent internet connection, such as an iOS device, or a desktop WebDAV client, etc. 

 This will configure everything necessary to track changes made by the user. When you wish to initiate a sync, or perform any other task, you'll need to call the `registerConfiguredDocumentSyncManager` method first to initiate registration.

 @warning You must call this method before using the document sync manager for any other purpose.

 Do not use this method of registration the very first time the user configures registration on a document, or the internal checks to update the sync attribute on any pre-existing managed objects will not be made.

 @param aDelegate The object you wish to be notified regarding document-related sync information; this object must conform to the `TICDSDocumentSyncManagerDelegate` protocol, which includes some required methods.
 @param anAppSyncManager The application sync manager responsible for overseeing this document.
 @param aContext The primary managed object context in your application; this must be an instance of `NSManagedObjectContext` and not just a plain `NSManagedObjectContext`.
 @param aDocumentIdentifier An identification string to identify this document uniquely. You would typically create a UUID string the first time this doc is registered and store this in e.g. the store metadata.
 @param aDocumentDescription A human-readable string used to identify this document, e.g. the full name of the document.
 @param someUserInfo A dictionary of information that will be saved throughout all future synchronizations. Because this information is saved in a plist, everything in the dictionary must be archivable using `NSKeyedArchiver`.
 */
- (void)configureWithDelegate:(id <TICDSDocumentSyncManagerDelegate>)aDelegate appSyncManager:(TICDSApplicationSyncManager *)anAppSyncManager managedObjectContext:(NSManagedObjectContext *)aContext documentIdentifier:(NSString *)aDocumentIdentifier description:(NSString *)aDocumentDescription userInfo:(NSDictionary *)someUserInfo;

In MoneyWell when we need to reset our sync managers we use this method:

- (void)resetSyncManagers
{
    [self.documentSyncManager deregisterDocumentSyncManager];
    self.documentSyncManager = nil;
    [TICDSApplicationSyncManager setDefaultApplicationSyncManager:nil];
    [self.managedObjectContext setDocumentSyncManager:nil];
}

That should work for deregistering the TICDSApplicationSyncManager.

from ticoredatasync.

Rjonhson avatar Rjonhson commented on July 28, 2024

Oh, do I have to configure only a TICDSDocumentSyncManager? I was configuring both TICDSApplicationSyncManager and TICDSDocumentSyncManager. This way it would never sync whatever changes I made before registering. I am going to test it out and update here. Thank you!

from ticoredatasync.

MrRooni avatar MrRooni commented on July 28, 2024

You will need a configured ApplicationSyncManager to configure the DocumentSyncManager, but once you configure that DSM it will capture all changes to your object graph that occur prior to the first sync.

from ticoredatasync.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.