Skip To Content ArcGIS for Developers Sign In Dashboard

Sync offline edits

Your users can edit offline and sync their edits to a feature service later when connectivity is restored. Syncing offline edits requires that a local geodatabase is created from an existing sync-enabled feature service either from ArcGIS Online or ArcGIS Enterprise. A user can take a single sync-enabled feature service offline or a map containing one or more sync-enabled feature services offline.

If you take a single feature service offline and edit the data in the geodatabase, you can sync the single geodatabase with the feature service using the AGSGeodatabaseSyncTask (see Sync offline edits.) Alternatively, if you take a whole map offline and create a geodatabase for each of the sync-enabled feature services in the map, you can sync all the geodatabases using the AGSOfflineMapSyncTask (see Synchronize a map.)

You should note that syncing can be performed, even if no edits have been made locally, to pull changes from the feature service into the local copy of the data.


A Basic license is required for editing.

Synchronize a single geodatabase

To synchronize edits made to a single geodatabase, do the following:

  • Create an AGSGeodatabaseSyncTask.
  • Create or generate sync parameters for the synchronization task.
  • Create an AGSJob by calling syncJobWithParameters on the task, passing in the parameters you created.
  • Call startWithStatusHandler to start the sync operation, defining a block to report the job completion.
//Create the synchronization parameters and set the layer options
AGSSyncGeodatabaseParameters *params = [[AGSSyncGeodatabaseParameters alloc] init];
params.layerOptions = syncLayerOptions;
//Instantiate a job to submit the sync job on the server using the
//synchronization parameters and the geodatabase containing the edits

self.syncJob = [self.geodatabaseSyncTask syncJobWithParameters:params geodatabase:self.generatedGeodatabase];
//Start the sync job by submitting it to server. 
//The statusHandler block is invoked periodically whenever the job's status changes
//The completion block is invked with the result when the job succeeds, or an error if it fails

[self.syncJob startWithStatusHandler:^(AGSJobStatus status) {
 //print the status} 
 completion:^(id  _Nullable result, NSError * _Nullable error) {
  if (error != nil) {
   NSLog(@"Error = %@", error.localizedDescription);
  else {
   NSLog(@"Synchronization complete");

The sync operation overwrites previously synced edits to the same features on the service.

Internally, ArcGIS Runtime uses a geodatabase transaction to wrap the synchronization process. Since only one current transaction is permitted on a geodatabase, you will receive an error if you attempt to synchronize while another transaction is active (in an editing workflow, for example). Similarly, you may get an error if you try to start a transaction while synchronization is in progress. Errors that arise during a sync operation are returned in the callback when the job is done. For descriptions of errors that can arise when syncing offline edits, see Error handling with sync.

For services backed by non-versioned data, sync operations are performed per-layer, and are always bi-directional—that is, local edits are uploaded to the service, and then new edits are downloaded from the service. For services backed by versioned data, sync operations are per-geodatabase, and you can change the synchronization parameters to determine in which direction edits are synchronized—download only, upload only, or bi-directional. Use AGSGeodatabase.syncModel to find out if a geodatabase can be synchronized per-layer or per-geodatabase. Use AGSSyncGeodatabaseParamters.geodatabaseSyncDirection to set the synchronization direction for a sync operation. When using bi-directional sync, note that the 'last in wins'—that is, uploaded edits will overwrite changes present on the server.

Synchronize a map

You can synchronize all the edits made to all the sync-enabled geodatabases in your map using the offline map sync task.

  • Create an AGSOfflineMapSyncTask.
  • Create the AGSOfflineMapSyncParameters()
  • Create an AGSJob by calling the offlineMapSyncJob on the task, passing in the parameters you created.
  • Call start to start the sync job and defining a completion block to report the job completion.

Register a geodatabase workflow

To work offline with a sync-enabled feature service, you need to download a geodatabase containing the features to your device. As mentioned in the Take a layer offline, Take a map offline - on-demand, and Take a map offline - preplanned topics, you can download a geodatabase to your device using any of these methods:

  • generateJobWithParameters on AGSGeodatabaseSyncTask
  • generateOfflineMapJobWithParameters on AGSOfflineMapTask
  • downloadPreplannedOfflineMapJobWithArea on AGSOfflineMapTask
Each of these methods will automatically register the geodatabase with the feature service so that you can sync any changes with the feature service as described above.

If, however, you copy that geodatabase file to another device, the feature service will not be able to perform a sync with that geodatabase. If you wish to enable sync you must register the geodatabase with the feature service you used to generate the original geodatabase. To do this you must use the use registerSyncEnabledGeodatabase method on AGSGeodatabaseSyncTask to register each geodatabase copy (on each device). Registering in this way ensures each device receives the correct updates during sync operations.


  • Registering a geodatabase with a feature service is not supported with a versioned feature service.
  • Once you call unregister on a geodatabase, you cannot re-register the same geodatabase.
  • If the original geodatabase is ever unregistered, no additional clients can use that copy to register.