ArcGIS Runtime SDK for iOS
100.15
|
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:
AGSGeodatabase
Instance Methods | |
(void) | - cancelLoad |
(id< AGSCancelable >) | - defaultGenerateGeodatabaseParametersWithExtent:completion: |
(id< AGSCancelable >) | - defaultSyncGeodatabaseParametersWithGeodatabase:completion: |
(id< AGSCancelable >) | - defaultSyncGeodatabaseParametersWithGeodatabase:syncDirection:completion: |
(void) | - doCancelLoading |
(void) | - doStartLoading: |
(AGSGenerateGeodatabaseJob *) | - generateJobWithParameters:downloadFileURL: |
(id< AGSCancelable >) | - importDeltaWithGeodatabase:inputPath:completion: |
(instancetype) | - initWithURL: |
(void) | - loadDidFinishWithError: |
(void) | - loadWithCompletion: |
(void) | - onLoadStatusChanged |
(id< AGSCancelable >) | - registerSyncEnabledGeodatabase:completion: |
(void) | - retryLoadWithCompletion: |
(AGSSyncGeodatabaseJob *) | - syncJobWithParameters:geodatabase: |
(AGSSyncGeodatabaseJob *) | - syncJobWithSyncDirection:rollbackOnFailure:geodatabase: |
(id< AGSCancelable >) | - unregisterGeodatabase:completion: |
(id< AGSCancelable >) | - unregisterGeodatabaseWithSyncID:completion: |
Class Methods | |
(id< AGSCancelable >) | + exportDeltaWithGeodatabase:outputFileURL:completion: |
(instancetype) | + geodatabaseSyncTaskWithURL: |
(id< AGSCancelable >) | + importDeltaWithGeodatabase:deltaPath:completion: |
Properties | |
NSString * | APIKey |
AGSCredential * | credential |
AGSArcGISFeatureServiceInfo * | featureServiceInfo |
NSError * | loadError |
AGSLoadStatus | loadStatus |
AGSRequestConfiguration * | requestConfiguration |
NSURL * | URL |
|
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
- (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 an AGSSyncModelLayer
sync model then an AGSSyncModelGeodatabase
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.
completion | block that is invoked with the initialized params if the method succeeds, or an error if it fails. |
- (id<AGSCancelable>) defaultSyncGeodatabaseParametersWithGeodatabase: | (AGSGeodatabase *) | geodatabase | |
completion: | (nullable void(^)(AGSSyncGeodatabaseParameters *__nullable params, NSError *__nullable error)) | completion | |
Creates default parameters for a sync geodatabase.
This will populate the parameters with values matching what the sync task's feature service and the geodatabase supports. For a geodatabase with AGSSyncModelLayer
, all geodatabase layers will be included. If the service is read-only, then the sync direction will be AGSSyncDirectionDownload
. Otherwise the sync direction will be AGSSyncDirectionBidirectional
.
geodatabase | that needs to be synchronized with its service. |
completion | block that is invoked with the initialized params if the method succeeds, or an error if it fails. |
- (id<AGSCancelable>) defaultSyncGeodatabaseParametersWithGeodatabase: | (AGSGeodatabase *) | geodatabase | |
syncDirection: | (AGSSyncDirection) | syncDirection | |
completion: | (nullable void(^)(AGSSyncGeodatabaseParameters *__nullable params, NSError *__nullable error)) | completion | |
Creates default parameters for a sync geodatabase using the given sync direction.
This will populate the parameters with values matching what the sync task's feature service and the geodatabase supports.
For a geodatabase with a AGSSyncModelLayer
object, all geodatabase layers will be included.
A service is editable if it has capabilities that include any of create, update or delete. In this case both AGSSyncDirectionBidirectional
and AGSSyncDirectionUpload
are supported sync directions. Alternatively, a service that does not have create, update or delete capability is considered read-only and only AGSSyncDirectionDownload
will be supported. If the given sync direction is not compatible with the sync task's feature service or the geodatabase is not sync enabled, the returned task will fail.
Returns a parameters object with the given sync direction. Other parameters are populated with default values.
geodatabase | that needs to be synchronized with its service. |
syncDirection | the sync direction to use. |
completion | block that is invoked with the initialized params if the method succeeds, or an error if it fails. |
- (void) doCancelLoading |
Never call this method directly. The framework calls this method on a background thread when cancelLoad (AGSLoadable-p)
is called. It is meant to be overriden by subclasses. Subclasses should override this method to cancel loading their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly))
at the end passing in an error representing NSUserCancelledError
.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (void) doStartLoading: | (BOOL) | retrying |
Never call this method directly. The framework calls this method on a background thread when loadWithCompletion: (AGSLoadable-p)
or retryLoadWithCompletion: (AGSLoadable-p)
is called. It is meant to be overriden by subclasses. Subclasses should override this method to load their data and call loadDidFinishWithError: (AGSLoadableBase(ForSubclassEyesOnly))
upon completion, passing in the error if any.
retrying | flag that is true if this method was called from retryLoadWithCompletion: (AGSLoadable-p) . |
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
+ (id<AGSCancelable>) exportDeltaWithGeodatabase: | (AGSGeodatabase *) | geodatabase | |
outputFileURL: | (NSURL *) | outputFileURL | |
completion: | (void(^)(BOOL result, NSError *__nullable error)) | completion | |
Generates an upload delta geodatabase file containing all the changes since the last sync.
A delta geodatabase contains the changes that have occurred since a mobile replica AGSGeodatabase
was last-synchronized with the feature service. See https://developers.arcgis.com/rest/services-reference/enterprise/synchronize-replica.htm for an overview of the delta files used in synchronization. An "upload" delta geodatabase contains the local edits, performed on the user's device, to be sent to the originating feature service.
When you run this task, any local edits in the AGSGeodatabase
will be exported to the specified output URL. The output URL should include the full path and file name (ending in ".geodatabase") for the export.
The delta file created by this method is not sent to the server and has no impact on any subsequent sync job. You can call this method repeatedly without affecting the state of the local geodatabase.
The task returned by this method has a boolean result that indicates whether or not a delta geodatabase was created.
You should not execute more than one sync on a particular geodatabase at the same time. This includes operations that export or import deltas from the local AGSGeodatabase:
exportDeltaWithGeodatabase:outputFileURL:completion:
importDeltaWithGeodatabase:deltaPath:completion:
AGSSyncGeodatabaseJob
AGSOfflineMapSyncJob
geodatabase | The geodatabase to generate a delta from. |
outputFileURL | The path and filename to save the generated delta to. |
completion | A block that is invoked when the operation finishes. The result parameter is populated if the operation completed successfully, otherwise the error parameter is populated. |
- (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
.
startWithStatusHandler:completion: (AGSGenerateGeodatabaseJob)
parameters | specifying what data to include in the generated geodatabase. |
downloadFileURL | where the geodatabase should be saved on disk, including the desired file name ending with the .geodatabase file extension. |
AGSGeodatabase
. + (instancetype) geodatabaseSyncTaskWithURL: | (NSURL *) | URL |
Creates a task with a URL to a sync-enabled ArcGIS feature service.
URL | to a sync-enabled ArcGIS feature service. |
+ (id<AGSCancelable>) importDeltaWithGeodatabase: | (AGSGeodatabase *) | geodatabase | |
deltaPath: | (NSURL *) | deltaPath | |
completion: | (void(^)(NSArray< AGSSyncLayerResult * > *__nullable result, NSError *__nullable error)) | completion | |
Imports a geodatabase delta and applies it to the given geodatabase.
A delta geodatabase contains the changes that have occurred since a mobile replica AGSGeodatabase
was last-synchronized with the feature service. See https://developers.arcgis.com/rest/services-reference/enterprise/synchronize-replica.htm for an overview of the delta files used in synchronization. A "download" delta geodatabase contains the online edits that will be imported to the local geodatabase.
The task returned by this method returns an array of AGSSyncLayerResult
.
You should not execute more than one sync on a particular geodatabase at the same time. This includes operations that export or import deltas from the local AGSGeodatabase:
exportDeltaWithGeodatabase:outputFileURL:completion:
importDeltaWithGeodatabase:deltaPath:completion:
AGSSyncGeodatabaseJob
AGSOfflineMapSyncJob
geodatabase | into which to import the delta. |
deltaPath | of the delta file (*.gdb file) containing the changes from the sync-enabled feature service. |
completion | block that is invoked when the operation completes successfully or encounters an error. |
- (id<AGSCancelable>) importDeltaWithGeodatabase: | (AGSGeodatabase *) | geodatabase | |
inputPath: | (NSString *) | inputPath | |
completion: | (void(^)(NSArray< AGSSyncLayerResult * > *_Nullable result, NSError *_Nullable error)) | completion | |
Imports a geodatabase delta and applies it to the given 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.
A delta geodatabase contains the changes that have occurred since a mobile replica AGSGeodatabase
was last synchronized with the feature service. See https://developers.arcgis.com/rest/services-reference/enterprise/synchronize-replica.htm for an overview of the delta files used in synchronization. A "download" delta geodatabase contains the online edits which will be imported to the local geodatabase.
The completion handler takes an array of AGSSyncLayerResult
.
You should not execute more than one sync on a geodatabase at the same time. This includes operations that export or import deltas from the local AGSGeodatabase:
exportDeltaWithGeodatabase:outputFileURL:completion:
importDeltaWithGeodatabase:deltaPath:completion:
AGSSyncGeodatabaseJob
AGSOfflineMapSyncJob
geodatabase | The geodatabase into which to import the delta. |
inputPath | The path of the delta file (*.gdb file) containing the changes from the sync-enabled feature service. |
completion | A block that is invoked when the operation completes successfully or encounters an error. |
importDeltaWithGeodatabase:deltaPath:completion:
instead. Provided by category AGSGeodatabaseSyncTask(AGSDeprecated).
- (instancetype) initWithURL: | (NSURL *) | URL |
Creates a task with a URL to a sync-enabled ArcGIS feature service.
URL | to a sync-enabled ArcGIS feature service. |
- (void) loadDidFinishWithError: | (nullable NSError *) | error |
Only subclasses should call this method in doStartLoading: (AGSLoadableBase(ForSubclassEyesOnly))
and doCancelLoading (AGSLoadableBase(ForSubclassEyesOnly))
when done loading or failed to load.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
|
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.
completion | block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. |
- cancelLoad
to cancel loading - retryLoadWithCompletion:
to force reload - (void) onLoadStatusChanged |
Never call this method directly. The framework calls this method on a background thread when AGSLoadable::loadStatus
changes is called. Subclasses can optionally implement this to know when their loading status has changed.
Provided by category AGSLoadableBase(ForSubclassEyesOnly).
- (id<AGSCancelable>) registerSyncEnabledGeodatabase: | (AGSGeodatabase *) | geodatabase | |
completion: | (nullable void(^)(NSError *__nullable error)) | completion | |
Registers a copy of a sync enabled geodatabase with a service to allow the copy to sync changes.
This method is typically used as part of services pattern workflow, sometimes known as a pre-planned workflow. A sync enabled geodatabase is generated centrally and not modified or synced. Copies of this original geodatabase are distributed and loaded onto each user's device. The copy must first be registered with the service to allow the server to identify changes in subsequent sync operations. One of the main benefits of this workflow is a reduction in server load to generate geodatabases for many clients. It is important not to sync the copy before registering to ensure the server can maintain consistent state on each copy. This operation is not the opposite of unregisterGeodatabase:completion:
which is used to remove a geodatabase from the service prior to deletion.
geodatabase | The sync-enabled geodatabase to register as a new replica with the originating service. |
completion | block that is invoked when the operation completes successfully or encounters an error. |
|
requiredinherited |
Tries to reload when an object has failed to load. This method should be called judiciously. It should be called when:
cancelLoad
and then this methodIf 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.
completion | block that is invoked when object loads successfully or fails to load. An error is passed to the block if the object fails to load. |
- (id<AGSCancelable>) unregisterGeodatabase: | (AGSGeodatabase *) | geodatabase | |
completion: | (nullable void(^)(NSError *__nullable error)) | completion | |
Unregisters a geodatabase from a service removing the service's replica id.
After unregistering a geodatabase, it can no longer be synced back to the service. This is often used prior to deleting a local geodatabase. The local geodatabase will be left behind, but all information about the geodatabase on the service will be removed. This operation is not related to registerSyncEnabledGeodatabase:completion:
, which is for registering copies of a sync enabled geodatabase.
geodatabase | to unregister. |
completion | block that is invoked when the operation completes successfully or encounters an error. |
- (id<AGSCancelable>) unregisterGeodatabaseWithSyncID: | (NSUUID *) | syncID | |
completion: | (nullable void(^)(NSError *__nullable error)) | completion | |
Unregisters a geodatabase from a service removing the service's replica id. This overload uses the geodatabase's sync ID rather than a reference to the geodatabase itself.
This method is used to unregister a geodatabase from a service using the sync ID. This is commonly used to enable cleanup of the service after the local geodatabase has already been deleted. See AGSGeodatabase::syncID
. After unregistering a geodatabase it can no longer be synced back to the service. This operation is not related to registerSyncEnabledGeodatabase:completion:
, which is for registering copies of a sync enabled geodatabase.
syncID | of the geodatabase to unregister. |
completion | block that is invoked when the operation completes successfully or encounters an error. |
|
readwriterequirednonatomiccopyinherited |
The API key to access API key enabled services and resources in ArcGIS Online.
An API key is a unique key used to authorize access to specific services and resources in ArcGIS Online. It is also used to monitor access to those services. An API key is created and managed in the ArcGIS developer dashboard and is tied to a specific ArcGIS account.
In addition to setting an API key at a global level for your application using the AGSArcGISRuntimeEnvironment::APIKey
property, you can set an AGSAPIKeyResource::APIKey
property on any ArcGIS Runtime class that implements AGSAPIKeyResource
. When you set an individual AGSAPIKeyResource::APIKey
property on an AGSAPIKeyResource
it will override the default key at the global level (on the AGSArcGISRuntimeEnvironment::APIKey
property, in other words), enabling more granular usage telemetry and management for ArcGIS Online resources used by your app. Classes that expose an API key property by implementing AGSAPIKeyResource
include:
|
readwritenonatomicstronginherited |
Security credentials to access the remote resource. Only applicable if the resource is secured.
|
readnonatomicstrong |
Metadata about the ArcGIS feature service that the task is using.
|
readnonatomicstronginherited |
The error that was encountered during the most recent load operation. Will be nil if the operation succeeded.
|
readrequirednonatomicassigninherited |
Status of the load operation.
|
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.
|
readrequirednonatomicstronginherited |
The URL of the remote resource.