ArcGIS Runtime SDK for iOS: AGSGeodatabaseSyncTask Class Reference
ArcGIS Runtime SDK for iOS  100.9
AGSGeodatabaseSyncTask Class Reference

Description

A task to download and synchronize a sync-enabled geodatabase.

Instances of this class represent a task that can be used to create, download, and synchronize a sync-enabled geodatabase from a sync-enabled ArcGIS Feature service. The service could be hosted in the cloud on ArcGIS Online or on-premises with ArcGIS servers.

Geodatabases generated from an ArcGIS feature service can be used for querying and viewing feature data when the application is offline. Geodatabases can also be edited when offline. Geodatabases for editing can only be requested if the service supports synchronization.

Geodatabases can be synchronized with the service when the application is able to connect to a network again. Synchronization can perform two tasks:

  • upload to the service changes made while offline
  • download changes made on the service to the geodatabase
Since
100
See also
AGSGeodatabase
Inheritance diagram for AGSGeodatabaseSyncTask:
AGSLoadableRemoteResourceBase AGSLoadableBase <AGSRemoteResource> AGSObject <AGSLoadable>

Instance Methods

(void) - cancelLoad
 
(id< AGSCancelable >) - defaultGenerateGeodatabaseParametersWithExtent:completion:
 
(id< AGSCancelable >) - defaultSyncGeodatabaseParametersWithGeodatabase:completion:
 
(id< AGSCancelable >) - defaultSyncGeodatabaseParametersWithGeodatabase:syncDirection:completion:
 
(AGSGenerateGeodatabaseJob *) - generateJobWithParameters:downloadFileURL:
 
(id< AGSCancelable >) - importDeltaWithGeodatabase:inputPath:completion:
 
(instancetype) - initWithURL:
 
(void) - loadWithCompletion:
 
(id< AGSCancelable >) - registerSyncEnabledGeodatabase:completion:
 
(void) - retryLoadWithCompletion:
 
(AGSSyncGeodatabaseJob *) - syncJobWithParameters:geodatabase:
 
(AGSSyncGeodatabaseJob *) - syncJobWithSyncDirection:rollbackOnFailure:geodatabase:
 
(id< AGSCancelable >) - unregisterGeodatabase:completion:
 
(id< AGSCancelable >) - unregisterGeodatabaseWithSyncID:completion:
 

Class Methods

(instancetype) + geodatabaseSyncTaskWithURL:
 
(id< AGSCancelable >) + importDeltaWithGeodatabase:deltaPath:completion:
 

Properties

AGSCredentialcredential
 
AGSArcGISFeatureServiceInfofeatureServiceInfo
 
NSError * loadError
 
AGSLoadStatus loadStatus
 
AGSRequestConfigurationrequestConfiguration
 
NSURL * URL
 

Method Documentation

§ cancelLoad()

- (void) cancelLoad
requiredinherited

Cancels loading if it is in progress, otherwise it does nothing. This should be called carefully because other objects could be waiting for loadWithCompletion: or retryLoadWithCompletion: to complete and this will call them all back with the error of NSUserCancelledError

Since
100

§ defaultGenerateGeodatabaseParametersWithExtent:completion:()

- (id<AGSCancelable>) defaultGenerateGeodatabaseParametersWithExtent: (AGSGeometry *)  extent
completion: (nullable void(^)(AGSGenerateGeodatabaseParameters *__nullable params, NSError *__nullable error))  completion 

A convenience method to get properly initialized parameters for generating a geodatabase.

This will populate the parameters with values matching what the service supports. For example if the service does not support PER_LAYER sync model then PER_GEODATABASE will be used. All layers from the service will be included. The extent will be the service's full extent. Attachments are included by default, but related tables/layers are not included. Features inside the provided extent are included in the generated geodatabase. Output features are in the spatial reference of the given extent.

Parameters
completionblock that is invoked with the initialized params if the method succeeds, or an error if it fails
Returns
operation that can be canceled
Since
100

§ defaultSyncGeodatabaseParametersWithGeodatabase:completion:()

- (id<AGSCancelable>) defaultSyncGeodatabaseParametersWithGeodatabase: (AGSGeodatabase *)  geodatabase
completion: (nullable void(^)(AGSSyncGeodatabaseParameters *__nullable params, NSError *__nullable error))  completion 

A convenience method to get properly initialized parameters for synchronizing a geodatabase with its service.

This will populate the parameters with values matching what the service and the geodatabase support. For a geodatabase with PER_LAYER sync model, all geodatabase layers will be included. If the service is read-only then the sync direction will be DOWNLOAD. Otherwise the sync direction will be BIDIRECTIONAL.

Parameters
geodatabasethat needs to be synchronized with its service
completionblock that is invoked with the initialized params if the method succeeds, or an error if it fails
Returns
operation that can be canceled
Since
100

§ defaultSyncGeodatabaseParametersWithGeodatabase:syncDirection:completion:()

- (id<AGSCancelable>) defaultSyncGeodatabaseParametersWithGeodatabase: (AGSGeodatabase *)  geodatabase
syncDirection: (AGSSyncDirection syncDirection
completion: (nullable void(^)(AGSSyncGeodatabaseParameters *__nullable params, NSError *__nullable error))  completion 

A convenience method to get properly initialized parameters for synchronizing a geodatabase with its service. Returns a parameters object with the given sync direction. Other parameters are populated with default values.

Parameters
geodatabasethat needs to be synchronized with its service
syncDirectionthe sync direction to use
completionblock that is invoked with the initialized params if the method succeeds, or an error if it fails
Returns
operation that can be canceled
Since
100.3

§ generateJobWithParameters:downloadFileURL:()

- (AGSGenerateGeodatabaseJob*) generateJobWithParameters: (AGSGenerateGeodatabaseParameters *)  parameters
downloadFileURL: (NSURL *)  downloadFileURL 

Returns a job which can be used to generate a geodatabase from an ArcGIS Feature service using the specified parameters. The result of the job will be of type AGSGeodatabase.

Note
The job is dormant and needs to be explicitly started using startWithStatusHandler:completion: (AGSGenerateGeodatabaseJob)
Parameters
parametersspecifying what data to include in the generated geodatabase
downloadFileURLwhere the geodatabase should be saved on disk, including the desired file name ending with the .geodatabase file extension.
Returns
job representing the progress on the server. The result of the job will be of type AGSGeodatabase.
Since
100

§ geodatabaseSyncTaskWithURL:()

+ (instancetype) geodatabaseSyncTaskWithURL: (NSURL *)  URL

Initialize the task with a URL to a sync-enabled ArcGIS Feature service

Parameters
URLto a sync-enabled ArcGIS Feature service
Returns
initialized task
Since
100

§ importDeltaWithGeodatabase:deltaPath:completion:()

+ (id<AGSCancelable>) importDeltaWithGeodatabase: (AGSGeodatabase *)  geodatabase
deltaPath: (NSURL *)  deltaPath
completion: (void(^)(NSArray< AGSSyncLayerResult * > *__nullable result, NSError *__nullable error))  completion 

Import changes from a delta file (*.gdb file) into the geodatabase. This is useful in workflows where the client does not directly connect to the originating service to synchronize changes with the server (either because the client does not have access to the service, or to improve scalability where it is impractical for a large number of clients to depend upon the service). Rather, the changes from the sync-enabled service are made available as a delta file (*.gdb file) to all clients which then import them into their copy of the geodatabase.

Parameters
geodatabaseinto which to import the delta
deltaPathof the delta file (*.gdb file) containing the changes from the sync-enabled feature service.
completionblock that is invoked when the operation completes successfully or encounters an error
Since
100.3

§ importDeltaWithGeodatabase:inputPath:completion:()

- (id<AGSCancelable>) importDeltaWithGeodatabase: (AGSGeodatabase *)  geodatabase
inputPath: (NSString *)  inputPath
completion: (void(^)(NSArray< AGSSyncLayerResult * > *__nullable result, NSError *__nullable error))  completion 

Import changes from a delta file (*.gdb file) into the geodatabase. This is useful in workflows where the client does not directly connect to the originating service to synchronize changes with the server (either because the client does not have access to the service, or to improve scalability where it is impractical for a large number of clients to depend upon the service). Rather, the changes from the sync-enabled service are made available as a delta file (*.gdb file) to all clients which then import them into their copy of the geodatabase.

Parameters
geodatabaseinto which to import the delta
inputPathof the delta file (*.gdb file) containing the changes from the sync-enabled feature service.
completionblock that is invoked when the operation completes successfully or encounters an error
Since
100
Deprecated:
100.3. Use class method importDeltaWithGeodatabase:inputPath:completion: instead.

§ initWithURL:()

- (instancetype) initWithURL: (NSURL *)  URL

Initialize the task with a URL to a sync-enabled ArcGIS Feature service

Parameters
URLto a sync-enabled ArcGIS Feature service
Returns
initialized task
Since
100

§ loadWithCompletion:()

- (void) loadWithCompletion: (nullable void(^)(NSError *__nullable error))  completion
requiredinherited

Loads data for the object asynchronously. The completion block is invoked upon completion.

You can call this method any number of times, however only one attempt is made to load the data. If it is already loading, it will just continue to load (i.e. not force a reload). If it has already loaded successfully, the completion block will be invoked right away. If it has already failed to load, the completion block will be invoked right away with error previously encountered. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.

Parameters
completionblock that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load.
Note
The completion block is always invoked on the main thread.
Since
100
See also
- cancelLoad to cancel loading
- retryLoadWithCompletion: to force reload

§ registerSyncEnabledGeodatabase:completion:()

- (id<AGSCancelable>) registerSyncEnabledGeodatabase: (AGSGeodatabase *)  geodatabase
completion: (nullable void(^)(NSError *__nullable error))  completion 

Register an existing sync-enabled geodatabase as a new sync-enabled geodatabase with the originating service. The geodatabase can then sync changes with the service indepedently of any other copies of the geodatabase that may exist.

Parameters
geodatabaseThe sync-enabled geodatabase to register as a new replica with the originating service.
completionblock that is invoked when the operation completes successfully or encounters an error
Returns
operation that can be canceled
Since
100

§ retryLoadWithCompletion:()

- (void) retryLoadWithCompletion: (nullable void(^)(NSError *__nullable error))  completion
requiredinherited

Tries to reload when an object has failed to load. This method should be called judiciously. It should be called when:

  1. you didn't have network connectivity earlier when it failed and you want to retry now that you have connectivity
  2. the server was down earlier when it failed and you want to retry
  3. the request is taking too long and you want to cancel it and retry, in which case you will first call cancelLoad and then this method

If the data hasn't started loading, it will start loading. If it is already loading, it will just continue to load. If it has already loaded successfully, calls back right away. If it has already failed to load, tries again. This method supports multiple callers and will call them all back on completion. However, each caller's completion block will be invoked once and only once.

Parameters
completionblock that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load.
Note
The completion block is always invoked on the main thread.
Since
100

§ unregisterGeodatabase:completion:()

- (id<AGSCancelable>) unregisterGeodatabase: (AGSGeodatabase *)  geodatabase
completion: (nullable void(^)(NSError *__nullable error))  completion 

Unregister an existing sync-enabled geodatabase from its originating service. This removes the geodatabase's replica ID from the service which means it can no longer be synchronized. The local geodatabase will be left behind, but all information about the geodatabase on the service will be removed.

Note
Once a sync-enabled geodatabase is unregistered, it cannot be re-registered with the service.
Parameters
geodatabaseto unregister
completionblock that is invoked when the operation completes successfully or encounters an error
Returns
operation that can be canceled
Since
100

§ unregisterGeodatabaseWithSyncID:completion:()

- (id<AGSCancelable>) unregisterGeodatabaseWithSyncID: (NSUUID *)  syncID
completion: (nullable void(^)(NSError *__nullable error))  completion 

Unregister an existing sync-enabled geodatabase from its originating service. This removes the geodatabase's replica ID from the service which means it can no longer be synchronized. This overload uses the geodatabase's sync ID rather than a reference to the geodatabase itself which is commonly used to enable cleanup of the service after the local geodatabase has already been deleted.

Note
Once a sync-enabled geodatabase is unregistered, it cannot be re-registered with the service.
Parameters
syncIDof the geodatabase to unregister
completionblock that is invoked when the operation completes successfully or encounters an error
Returns
operation that can be canceled
Since
100.2

Property Documentation

§ credential

- (AGSCredential*) credential
readwritenonatomicstronginherited

Security credentials to access the remote resource. Only applicable if the resource is secured.

Since
100

§ featureServiceInfo

- (AGSArcGISFeatureServiceInfo*) featureServiceInfo
readnonatomicstrong

Metadata about the ArcGIS Feature service that the task is using

Since
100

§ loadError

- (NSError*) loadError
readnonatomicstronginherited

The error that was encountered during the most recent load operation. Will be nil if the operation succeeded.

Since
100

§ loadStatus

- (AGSLoadStatus) loadStatus
readrequirednonatomicassigninherited

Status of the load operation.

Since
100

§ requestConfiguration

- (AGSRequestConfiguration*) requestConfiguration
readwritenonatomicstronginherited

The AGSRequestConfiguration object which defines the behavior and policies to use when accessing the remote resource. The default will be nil. If it is nil the [AGSRequestConfiguration globalConfiguration] will be used.

Since
100

§ URL

- (NSURL*) URL
readrequirednonatomicstronginherited

The URL of the remote resource.

Since
100