TICDSApplicationSyncManager Class Reference
| Inherits from | NSObject |
| Conforms to | TICDSApplicationRegistrationOperationDelegate TICDSDocumentDeletionOperationDelegate TICDSRemoveAllRemoteSyncDataOperationDelegate |
| Declared in | TICDSApplicationSyncManager.h |
Overview
TICDSDocumentSyncManager describes the generic behavior provided by an Application Sync Manager in the TICoreDataSync framework.
The Application Sync Manager is responsible for application-wide synchronization settings. You typically have only one in an application.
Don’t instantiate this class directly, but instead use one of the subclasses:
You must register the application sync manager before you can use it to perform any other tasks, or register any documents.
Tasks
Application-Wide Sync Manager
-
+ defaultApplicationSyncManagerReturns an application-wide sync manager.
-
+ setDefaultApplicationSyncManager:Set the application-wide sync manager.
One-Shot Application Registration
-
– registerWithDelegate:globalAppIdentifier:uniqueClientIdentifier:description:userInfo:Register an application ready for future synchronization.
Delayed Application Registration
-
– configureWithDelegate:globalAppIdentifier:uniqueClientIdentifier:description:userInfo:Configure an application but don’t immediately register it.
-
– registerConfiguredApplicationSyncManagerRegister an application that has already been pre-configured.
Continuing Registration
-
– continueRegisteringWithEncryptionPassword:Continue registering an application for the first time specifying whether to use encryption, or an existing application that requires an encryption password.
-
– cancelRegistrationWithoutProvidingEncryptionPasswordCancel registration after being asked for an encryption password.
Accessing Previously Synchronized Documents
-
– requestListOfPreviouslySynchronizedDocumentsRequest a list of documents that have previously been synchronized for this application, by any client.
-
– requestDownloadOfDocumentWithIdentifier:toLocation:Download a document that has previously been synchronized for this application.
Accessing Client Information
-
– requestListOfSynchronizedClientsIncludingDocuments:Request a list of clients that are registered to synchronize with this application.
Deleting Documents
-
– deleteDocumentWithIdentifier:Delete the specified document, if it exists, from the remote.
Removing all Sync Data
-
– removeAllSyncDataFromRemoteRemove the entire remote directory structure from the remote.
Methods Overridden by Subclasses
-
– applicationRegistrationOperationReturns an application registration operation.
-
– listOfPreviouslySynchronizedDocumentsOperationReturns an operation to fetch a list of previously synchronized documents.
-
– wholeStoreDownloadOperationForDocumentWithIdentifier:Returns an operation to download a document with a given identifier.
-
– listOfApplicationRegisteredClientsOperationReturns an operation to fetch a list of registered clients for an application.
-
– documentDeletionOperationForDocumentWithIdentifier:Returns an operation to delete a document with a given identifier.
-
– removeAllSyncDataOperationReturns an operation to remove all remote sync data.
Properties
-
stateApplication Sync Manager State.
property -
shouldUseEncryptionUsed to indicate whether the application sync manager should use encryption for the remote files.
property -
delegateThe Application Sync Manager Delegate.
property -
appIdentifierThe App Identifier used for registration.
property -
clientIdentifierThe Client Identifier used for registration.
property -
clientDescriptionThe Client Description used for registration.
property -
applicationUserInfoThe User Info used for registration.
property -
fileManagerA File Manager for use by the application sync manager.
property
Operation Queues
-
registrationQueueThe operation queue used for registration operations.
property -
otherTasksQueueThe operation queue used for non-registration tasks.
property
Relative Paths
-
relativePathToDocumentsDirectoryThe path to the
propertyDocumentsdirectory, relative to the root of the remote file structure. -
relativePathToInformationDirectoryThe path to the
propertyInformationdirectory, relative to the root of the remote file structure. -
relativePathToInformationDeletedDocumentsDirectoryThe path to the
propertyDeletedDocumentsdirectory inside theInformationdirectory, relative ot the root of the remote file structure. -
relativePathToEncryptionDirectoryThe path to the
propertyEncryptiondirectory, relative to the root of the remote file structure. -
relativePathToEncryptionDirectorySaltDataFilePathThe path to the
propertysalt.ticdsyncfile inside theEncryptiondirectory, relative to the root of the remote file structure. -
relativePathToEncryptionDirectoryTestDataFilePathThe path to the
propertytest.ticdsyncfile inside theEncryptiondirectory, relative to the rot of the remote file structure. -
relativePathToClientDevicesDirectoryThe path to the
propertyClientDevicesdirectory, relative to the root of the remote file structure. -
relativePathToClientDevicesThisClientDeviceDirectoryThe path to this client’s directory inside the
propertyClientDevicesdirectory, relative to the root of the remote file structure. -
– relativePathToDocumentDirectoryForDocumentWithIdentifier:The path to a document’s directory within the
Documentsdirectory, relative to the root of the remote file structure. -
– relativePathToWholeStoreDirectoryForDocumentWithIdentifier:The path to a document’s
WholeStoredirectory, relative to the root of the remote file structure.
Properties
appIdentifier
The App Identifier used for registration.
@property (nonatomic, readonly, retain) NSString *appIdentifierDiscussion
Set the identifier when registering with registerWithDelegate:globalAppIdentifier:uniqueClientIdentifier:description:userInfo:.
Declared In
TICDSApplicationSyncManager.happlicationUserInfo
The User Info used for registration.
@property (nonatomic, readonly, retain) NSDictionary *applicationUserInfoDiscussion
Set the user info when registering with registerWithDelegate:globalAppIdentifier:uniqueClientIdentifier:description:userInfo:.
Declared In
TICDSApplicationSyncManager.hclientDescription
The Client Description used for registration.
@property (nonatomic, readonly, retain) NSString *clientDescriptionDiscussion
Set the description when registering with registerWithDelegate:globalAppIdentifier:uniqueClientIdentifier:description:userInfo:.
Declared In
TICDSApplicationSyncManager.hclientIdentifier
The Client Identifier used for registration.
@property (nonatomic, readonly, retain) NSString *clientIdentifierDiscussion
Set the identifier when registering with registerWithDelegate:globalAppIdentifier:uniqueClientIdentifier:description:userInfo:.
Declared In
TICDSApplicationSyncManager.hdelegate
The Application Sync Manager Delegate.
@property (nonatomic, assign) id<TICDSApplicationSyncManagerDelegate> delegateDeclared In
TICDSApplicationSyncManager.hfileManager
A File Manager for use by the application sync manager.
@property (nonatomic, readonly, retain) NSFileManager *fileManagerDeclared In
TICDSApplicationSyncManager.hotherTasksQueue
The operation queue used for non-registration tasks.
@property (nonatomic, readonly, retain) NSOperationQueue *otherTasksQueueDiscussion
The queue is suspended until registration has completed successfully.
Declared In
TICDSApplicationSyncManager.hregistrationQueue
The operation queue used for registration operations.
@property (nonatomic, readonly, retain) NSOperationQueue *registrationQueueDeclared In
TICDSApplicationSyncManager.hrelativePathToClientDevicesDirectory
The path to the ClientDevices directory, relative to the root of the remote file structure.
@property (nonatomic, readonly) NSString *relativePathToClientDevicesDirectoryDeclared In
TICDSApplicationSyncManager.hrelativePathToClientDevicesThisClientDeviceDirectory
The path to this client’s directory inside the ClientDevices directory, relative to the root of the remote file structure.
@property (nonatomic, readonly) NSString *relativePathToClientDevicesThisClientDeviceDirectoryDeclared In
TICDSApplicationSyncManager.hrelativePathToDocumentsDirectory
The path to the Documents directory, relative to the root of the remote file structure.
@property (nonatomic, readonly) NSString *relativePathToDocumentsDirectoryDeclared In
TICDSApplicationSyncManager.hrelativePathToEncryptionDirectory
The path to the Encryption directory, relative to the root of the remote file structure.
@property (nonatomic, readonly) NSString *relativePathToEncryptionDirectoryDeclared In
TICDSApplicationSyncManager.hrelativePathToEncryptionDirectorySaltDataFilePath
The path to the salt.ticdsync file inside the Encryption directory, relative to the root of the remote file structure.
@property (nonatomic, readonly) NSString *relativePathToEncryptionDirectorySaltDataFilePathDeclared In
TICDSApplicationSyncManager.hrelativePathToEncryptionDirectoryTestDataFilePath
The path to the test.ticdsync file inside the Encryption directory, relative to the rot of the remote file structure.
@property (nonatomic, readonly) NSString *relativePathToEncryptionDirectoryTestDataFilePathDeclared In
TICDSApplicationSyncManager.hrelativePathToInformationDeletedDocumentsDirectory
The path to the DeletedDocuments directory inside the Information directory, relative ot the root of the remote file structure.
@property (nonatomic, readonly) NSString *relativePathToInformationDeletedDocumentsDirectoryDeclared In
TICDSApplicationSyncManager.hrelativePathToInformationDirectory
The path to the Information directory, relative to the root of the remote file structure.
@property (nonatomic, readonly) NSString *relativePathToInformationDirectoryDeclared In
TICDSApplicationSyncManager.hshouldUseEncryption
Used to indicate whether the application sync manager should use encryption for the remote files.
@property (nonatomic, assign) BOOL shouldUseEncryptionDiscussion
This value is set automatically during the application registration process.
Declared In
TICDSApplicationSyncManager.hstate
Application Sync Manager State.
@property (nonatomic, readonly) TICDSApplicationSyncManagerState stateDiscussion
The state of the application sync manager indicates whether it is ready to synchronize.
Possible values are defined in TICDSTypesAndEnums.h.
Declared In
TICDSApplicationSyncManager.hClass Methods
defaultApplicationSyncManager
Returns an application-wide sync manager.
+ (id)defaultApplicationSyncManagerReturn Value
The default application-wide sync manager (if one doesn’t exist, it will be created).
Discussion
Use this method to get the default application sync manager. If this is the first time you’ve requested one, a new one will be created.
Don’t call this method on TICDSApplicationSyncManager; if you do, you’ll receive a generic application sync manager object. Instead call it on one of the subclasses, for example [TICDSFileManagerBasedApplicationSyncManager defaultSyncManager].
Declared In
TICDSApplicationSyncManager.hsetDefaultApplicationSyncManager:
Set the application-wide sync manager.
+ (void)setDefaultApplicationSyncManager:(TICDSApplicationSyncManager *)aSyncManagerParameters
- aSyncManager
The new sync manager to set as the application-wide default.
Discussion
Use this method if you need to release an existing default manager, or wish to use a different default one for some reason.
Declared In
TICDSApplicationSyncManager.hInstance Methods
applicationRegistrationOperation
Returns an application registration operation.
- (TICDSApplicationRegistrationOperation *)applicationRegistrationOperationReturn Value
A correctly-configured subclass of TICDSApplicationRegistrationOperation.
Discussion
Subclasses of TICDSApplicationSyncManager use this method to return a correctly-configured application registration operation for their particular sync method.
Declared In
TICDSApplicationSyncManager.hcancelRegistrationWithoutProvidingEncryptionPassword
Cancel registration after being asked for an encryption password.
- (void)cancelRegistrationWithoutProvidingEncryptionPasswordDiscussion
Use this method to cancel registration if the user is unable to provide the correct encryption password.
Using this method at other times will result in undefined behavior.
Declared In
TICDSApplicationSyncManager.hconfigureWithDelegate:globalAppIdentifier:uniqueClientIdentifier:description:userInfo:
Configure an application but don’t immediately register it.
- (void)configureWithDelegate:(id<TICDSApplicationSyncManagerDelegate>)aDelegate globalAppIdentifier:(NSString *)anAppIdentifier uniqueClientIdentifier:(NSString *)aClientIdentifier description:(NSString *)aClientDescription userInfo:(NSDictionary *)someUserInfoParameters
- aDelegate
The object you wish to be notified regarding application-related sync information; this object must conform to the
TICDSApplicationSyncManagerDelegateprotocol, which includes some required methods.
- anAppIdentifier
The identification string used to identify the synchronization information across multiple clients. If you wish to be able to synchronize Mac and iOS, this app identifier should be the same on both platforms. This identifier will also be used as the root level of the remote file structure.
- aClientIdentifier
An identification string for this client. Every client wishing to synchronize must have a string to identify itself (i.e., the application instance on a machine) uniquely. You would typically create a UUID string the first time your app is launched and store this in preferences.
- aClientDescription
A human-readable string used to identify this client, e.g. the computer name.
- 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.
Discussion
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 registerConfiguredApplicationSyncManager method first to initiate registration.
Declared In
TICDSApplicationSyncManager.hcontinueRegisteringWithEncryptionPassword:
Continue registering an application for the first time specifying whether to use encryption, or an existing application that requires an encryption password.
- (void)continueRegisteringWithEncryptionPassword:(NSString *)aPasswordParameters
- aPassword
The password to use, or
nilto specify no encryption on a new application registration.
Discussion
If you are requesting the registration process continue for a new application, and do not want to enable encryption, specify nil for the password, otherwise supply the password the user wishes to use.
If you are requesting the registration process continue for an existing application that requires an encryption password, you must specify a password other than nil.
Declared In
TICDSApplicationSyncManager.hdeleteDocumentWithIdentifier:
Delete the specified document, if it exists, from the remote.
- (void)deleteDocumentWithIdentifier:(NSString *)anIdentifierParameters
- anIdentifier
The identifier of the document to be deleted.
Discussion
As well as delegate methods indicating the status of the overall deletion process, applicationSyncManager:willDeleteDirectoryForDocumentWithIdentifier: and applicationSyncManager:didDeleteDirectoryForDocumentWithIdentifier: methods will be called either side of the deletion of the actual document directory.
Declared In
TICDSApplicationSyncManager.hdocumentDeletionOperationForDocumentWithIdentifier:
Returns an operation to delete a document with a given identifier.
- (TICDSDocumentDeletionOperation *)documentDeletionOperationForDocumentWithIdentifier:(NSString *)anIdentifierParameters
- anIdentifier
The unique synchronization identifier of the document to delete.
Return Value
A correctly-configured subclass of TICDSDocumentDeletionOperation.
Discussion
Subclasses of TICDSApplicationSyncManager use this method to return a correctly-configured document deletion operation for their particular sync method.
Declared In
TICDSApplicationSyncManager.hlistOfApplicationRegisteredClientsOperation
Returns an operation to fetch a list of registered clients for an application.
- (TICDSListOfApplicationRegisteredClientsOperation *)listOfApplicationRegisteredClientsOperationReturn Value
A correctly-configured subclass of TICDSListOfApplicationRegisteredClientsOperation.
Discussion
Subclasses of TICDSApplicationSyncManager use this method to return a correctly-configured operation for their particular sync method.
Declared In
TICDSApplicationSyncManager.hlistOfPreviouslySynchronizedDocumentsOperation
Returns an operation to fetch a list of previously synchronized documents.
- (TICDSListOfPreviouslySynchronizedDocumentsOperation *)listOfPreviouslySynchronizedDocumentsOperationReturn Value
A correctly-configured subclass of TICDSListOfPreviouslySynchronizedDocumentsOperation.
Discussion
Subclasses of TICDSApplicationSyncManager use this method to return a correctly-configured list of documents operation for their particular sync method.
Declared In
TICDSApplicationSyncManager.hregisterConfiguredApplicationSyncManager
Register an application that has already been pre-configured.
- (void)registerConfiguredApplicationSyncManagerDiscussion
Use this method to register an application sync manager that you have already configured using the configureWithDelegate:globalAppIdentifier:uniqueClientIdentifier:description:userInfo: method.
Declared In
TICDSApplicationSyncManager.hregisterWithDelegate:globalAppIdentifier:uniqueClientIdentifier:description:userInfo:
Register an application ready for future synchronization.
- (void)registerWithDelegate:(id<TICDSApplicationSyncManagerDelegate>)aDelegate globalAppIdentifier:(NSString *)anAppIdentifier uniqueClientIdentifier:(NSString *)aClientIdentifier description:(NSString *)aClientDescription userInfo:(NSDictionary *)someUserInfoParameters
- aDelegate
The object you wish to be notified regarding application-related sync information; this object must conform to the
TICDSApplicationSyncManagerDelegateprotocol, which includes some required methods.
- anAppIdentifier
The identification string used to identify the synchronization information across multiple clients. If you wish to be able to synchronize Mac and iOS, this app identifier should be the same on both platforms. This identifier will also be used as the root level of the remote file structure.
- aClientIdentifier
An identification string for this client. Every client wishing to synchronize must have a string to identify itself (i.e., the application instance on a machine) uniquely. You would typically create a UUID string the first time your app is launched and store this in preferences.
- aClientDescription
A human-readable string used to identify this client, e.g. the computer name.
- 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.
Discussion
Use this method to register the sync manager ready for document registration and synchronization (via TICDSDocumentSyncManager objects).
This will automatically spawn a TICDSApplicationRegistrationOperation, and notify you of progress through the TICDSApplicationSyncManagerDelegate methods.
If this is the first time you have registered a client with this app identifier, registration will automatically create the file structure necessary at the remote end for this and other clients to synchronize. See [TICDSUtilities remoteGlobalAppDirectoryHierarchy] for the structure that will be created.
Declared In
TICDSApplicationSyncManager.hrelativePathToDocumentDirectoryForDocumentWithIdentifier:
The path to a document’s directory within the Documents directory, relative to the root of the remote file structure.
- (NSString *)relativePathToDocumentDirectoryForDocumentWithIdentifier:(NSString *)anIdentifierParameters
- anIdentifier
The unique sync identifier of the document.
Declared In
TICDSApplicationSyncManager.hrelativePathToWholeStoreDirectoryForDocumentWithIdentifier:
The path to a document’s WholeStore directory, relative to the root of the remote file structure.
- (NSString *)relativePathToWholeStoreDirectoryForDocumentWithIdentifier:(NSString *)anIdentifierParameters
- anIdentifier
The unique sync identifier of the document.
Declared In
TICDSApplicationSyncManager.hremoveAllSyncDataFromRemote
Remove the entire remote directory structure from the remote.
- (void)removeAllSyncDataFromRemoteDiscussion
This will spawn a TICDSRemoveAllSyncDataOperation and notify the delegate of progress.
Declared In
TICDSApplicationSyncManager.hremoveAllSyncDataOperation
Returns an operation to remove all remote sync data.
- (TICDSRemoveAllRemoteSyncDataOperation *)removeAllSyncDataOperationReturn Value
A correctly-configured subclass of TICDSRemoveAllSyncDataOperation.
Discussion
Subclasses of TICDSApplicationSyncManager use this method to return a correctly-configured ‘remove all sync data’ operation for their particular sync method.
Declared In
TICDSApplicationSyncManager.hrequestDownloadOfDocumentWithIdentifier:toLocation:
Download a document that has previously been synchronized for this application.
- (void)requestDownloadOfDocumentWithIdentifier:(NSString *)anIdentifier toLocation:(NSURL *)aLocationParameters
- anIdentifier
The unique synchronization identifier string for the requested document. If you’re requesting the download of a document represented by a dictionary supplied from a request for the list of previously synchronized documents, use the value for its
kTICDSDocumentIdentifierkey.
- aLocation
The location on disc to which the persistent store file should be downloaded – including the file name.
Discussion
This method will automatically spawn a TICDSDocumentDownloadOperation, and notify you of progress through the TICDSApplicationSyncManagerDelegate methods.
The document will first be downloaded to a temporary location. If any file already exists at the location specified by aLocation, it will be removed once the dowload completes, before the newly-downloaded temporary file is moved to aLocation.
Declared In
TICDSApplicationSyncManager.hrequestListOfPreviouslySynchronizedDocuments
Request a list of documents that have previously been synchronized for this application, by any client.
- (void)requestListOfPreviouslySynchronizedDocumentsDiscussion
This method will automatically spawn a TICDSListOfPreviouslySynchronizedDocumentsOperation, and notify you of progress through the TICDSApplicationSyncManagerDelegate methods.
Declared In
TICDSApplicationSyncManager.hrequestListOfSynchronizedClientsIncludingDocuments:
Request a list of clients that are registered to synchronize with this application.
- (void)requestListOfSynchronizedClientsIncludingDocuments:(BOOL)includeDocumentsParameters
- includeDocuments
YESif the request should also include a list of documents that each client is registered to synchronize, otherwiseNO.
Discussion
This method returns a dictionary containing as keys the client identifiers, and as values the deviceInfo.plist information. If you specify YES for includeDocuments, each dictionary will also include an array containing the identifiers of documents for which the client is registered.
Declared In
TICDSApplicationSyncManager.hwholeStoreDownloadOperationForDocumentWithIdentifier:
Returns an operation to download a document with a given identifier.
- (TICDSWholeStoreDownloadOperation *)wholeStoreDownloadOperationForDocumentWithIdentifier:(NSString *)anIdentifierParameters
- anIdentifier
The unique synchronization identifier of the document to download.
Return Value
A correctly-configured subclass of TICDSWholeStoreDownloadOperation.
Discussion
Subclasses of TICDSApplicationSyncManager use this method to return a correctly-configured whole store download operation for their particular sync method.
Declared In
TICDSApplicationSyncManager.h