Adding Sync Options

Extending TICoreDataSync by adding support for other sync types, such as WebDAV

At present, TICoreDataSync support synchronization via anything you can access through NSFileManager, such as Dropbox or iDisk on the desktop, as well as the DropboxSDK for iOS applications.

A WebDAV-based set of classes are planned, as well as an entirely local-wifi, web-server based option.

If you need to add your own sync option, you’ll need to write a set of classes that must override certain methods.

Sync Managers

You’ll need to provide sync-specific subclasses of the two types of sync manager: application and document.

This means subclassing TICDSApplicationSyncManager and TICDSDocumentSyncManager. The methods you’re required to implement are the methods that return the operation objects used to perform the various synchronization-related tasks.

Operation Objects

You’ll also need to provide a set of operation classes to handle the upload and download of files during each synchronization task.

Each operation should be a subclass of one of the Generic Operations, such as TICDSApplicationRegistrationOperation or TICDSDocumentRegistrationOperation.

Each generic operation requires you to override specific methods to handle the file transfers between local and remote; as each file-movement task is complete, you’ll need to call back via a method to indicate success or failure.

Note that if encryption is enabled, your subclass is responsible for encrypting all files before they are uploaded, and decrypting all files before they are moved to their local locations. This is relatively trivial—see the TICDSFileManagerBasedApplicationRegistrationOperation.m file for an example.

For more information on what each operation does, either check the documentation, or take a look at the operation task diagrams.

Temporary Files

If you need a temporary location to store files locally, the underlying TICDSOperation class, from which all other generic operations are derived, will provide you with a directory specific to the operation.

Call the tempDirectoryPath method to return the path to this directory; if this is the first time it’s been requested, this will automatically be created before the method returns the path.

Note that once the operation completes all its tasks, this directory (and all its contents) will automatically be removed.

Documentation

Reference

Source Code

Available on GitHub

Contact