ArcGIS Runtime SDK for iOS: AGSServiceGeodatabase Class Reference
ArcGIS Runtime SDK for iOS  100.15
AGSServiceGeodatabase Class Reference

Description

A container for a collection of AGSServiceFeatureTable connected to a feature service.

An AGSServiceGeodatabase connects to a feature service as a whole, grouping together AGSServiceFeatureTable instances for related records queries, connecting to a version in a branch-versioned service, and managing edits for all tables.

Since
100.9
Inheritance diagram for AGSServiceGeodatabase:
AGSLoadableBase <AGSRemoteResource> AGSObject <AGSLoadable>

Instance Methods

(id< AGSCancelable >) - applyEditsWithCompletion:
 
(void) - cancelLoad
 
(id< AGSCancelable >) - closeWithCompletion:
 
(id< AGSCancelable >) - createVersionWithParameters:completion:
 
(void) - doCancelLoading
 
(void) - doStartLoading:
 
(id< AGSCancelable >) - fetchVersionsWithCompletion:
 
(BOOL) - hasLocalEdits
 
(instancetype) - initWithPortalItem:
 
(instancetype) - initWithPortalItem:sessionType:
 
(instancetype) - initWithPortalItem:versionName:
 
(instancetype) - initWithPortalItem:versionName:sessionType:
 
(instancetype) - initWithURL:
 
(instancetype) - initWithURL:sessionType:
 
(instancetype) - initWithURL:versionName:
 
(instancetype) - initWithURL:versionName:sessionType:
 
(void) - loadDidFinishWithError:
 
(void) - loadWithCompletion:
 
(void) - onLoadStatusChanged
 
(void) - retryLoadWithCompletion:
 
(id< AGSCancelable >) - switchVersionWithName:completion:
 
(nullable AGSServiceFeatureTable *) - tableWithLayerID:
 
(id< AGSCancelable >) - undoLocalEditsWithCompletion:
 

Class Methods

(instancetype) + serviceGeodatabaseWithPortalItem:
 
(instancetype) + serviceGeodatabaseWithPortalItem:sessionType:
 
(instancetype) + serviceGeodatabaseWithPortalItem:versionName:
 
(instancetype) + serviceGeodatabaseWithPortalItem:versionName:sessionType:
 
(instancetype) + serviceGeodatabaseWithURL:
 
(instancetype) + serviceGeodatabaseWithURL:sessionType:
 
(instancetype) + serviceGeodatabaseWithURL:versionName:
 
(instancetype) + serviceGeodatabaseWithURL:versionName:sessionType:
 

Properties

NSArray< AGSServiceFeatureTable * > * connectedTables
 
AGSCredentialcredential
 
NSString * defaultVersionName
 
NSError * loadError
 
AGSLoadStatus loadStatus
 
AGSPortalItemportalItem
 
AGSRequestConfigurationrequestConfiguration
 
AGSArcGISFeatureServiceInfoserviceInfo
 
AGSFeatureServiceSessionType sessionType
 
BOOL supportsBranchVersioning
 
NSURL * URL
 
NSString * versionName
 

Method Documentation

◆ applyEditsWithCompletion:

- (id<AGSCancelable>) applyEditsWithCompletion: (void(^)(NSArray< AGSFeatureTableEditResult * > *__nullable result, NSError *__nullable error))  completion

Applies all local edits in all tables to the service.

Edits in all tables are applied to the feature service in a single call, which is more efficient than doing so one AGSServiceFeatureTable at a time.

Parameters
completionA block that is invoked when the operation finishes. The result parameter is populated if the operation completed successfully, otherwise the error parameter is populated.
Returns
An operation which can be canceled.
See also
AGSFeatureServiceSessionType
Since
100.9

◆ 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

◆ closeWithCompletion:

- (id<AGSCancelable>) closeWithCompletion: (void(^)(NSError *__nullable error))  completion

Closes this service geodatabase.

A request to stop any active reading or editing sessions with the feature service is sent and once this asynchronous process is complete, this service geodatabase will be closed.

Before calling this method, there should be no references to all related data. For example, terminate fetch versions, create version, switch, apply or undo edits, remove feature layers, and release tables from map.

After calling this method, accessing this service geodatabase or any of its connected tables will fail with AGSErrorCodeGDBDatabaseClosed.

Closing this service geodatabase is not necessary if it has not been loaded.

Parameters
completionThe error parameter is populated on failure.
Returns
An operation which can be canceled.
Since
100.10

◆ createVersionWithParameters:completion:

- (id<AGSCancelable>) createVersionWithParameters: (AGSServiceVersionParameters *)  parameters
completion: (void(^)(AGSServiceVersionInfo *__nullable result, NSError *__nullable error))  completion 

Creates a new version in the service based on the default version.

Branch versioning requires that the default version always be the ancestor of all other versions.

If the service isn't branch versioned, this will complete with AGSErrorCodeMappingBranchVersioningNotSupportedByService If the version parameters do not include a name, this will complete with an error.

Parameters
parametersThe properties of the new version.
completionA block that is invoked when the operation finishes. The result parameter is populated if the operation completed successfully, otherwise the error parameter is populated.
Returns
An operation which can be canceled.
Since
100.9

◆ doCancelLoading

- (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.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ doStartLoading:

- (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.

Parameters
retryingflag that is true if this method was called from retryLoadWithCompletion: (AGSLoadable-p).
Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ fetchVersionsWithCompletion:

- (id<AGSCancelable>) fetchVersionsWithCompletion: (void(^)(NSArray< AGSServiceVersionInfo * > *__nullable result, NSError *__nullable error))  completion

Gets a list of all versions on the service.

If the service isn't branch versioned, this will complete with AGSErrorCodeMappingBranchVersioningNotSupportedByService

Parameters
completionA block that is invoked when the operation finishes. The result parameter is populated if the operation completed successfully, otherwise the error parameter is populated.
Returns
An operation which can be canceled.
Since
100.9

◆ hasLocalEdits

- (BOOL) hasLocalEdits

Determines if any of the tables in the AGSServiceGeodatabase have unapplied edits.

Returns
Whether any of the tables have unapplied edits.
Since
100.9

◆ initWithPortalItem:

- (instancetype) initWithPortalItem: (AGSPortalItem *)  portalItem

Creates a new AGSServiceGeodatabase object from a feature service portal item, and connects to the default version in the feature service.

If the service is branch versioned, the AGSServiceGeodatabase will connect to the default version.

Parameters
portalItemA feature service AGSPortalItem.
See also
AGSServiceGeodatabase::portalItem
Since
100.12

◆ initWithPortalItem:sessionType:

- (instancetype) initWithPortalItem: (AGSPortalItem *)  portalItem
sessionType: (AGSFeatureServiceSessionType sessionType 

Creates a new AGSServiceGeodatabase object from a feature service portal item, and connects to the default version in the feature service.

If the service is branch versioned, the AGSServiceGeodatabase will connect to the default version.

If using AGSFeatureServiceSessionTypePersistent, it is important to call closeWithCompletion: before destruction.

Parameters
portalItemA feature service AGSPortalItem.
sessionTypeThe type of read and edit sessions to use when working with the service.
See also
AGSServiceGeodatabase::portalItem
Since
100.12

◆ initWithPortalItem:versionName:

- (instancetype) initWithPortalItem: (AGSPortalItem *)  portalItem
versionName: (NSString *)  versionName 

Creates a new AGSServiceGeodatabase object from a feature service portal item, and connects to a specific version in the feature service.

If a version with the name does not exist, or the service is not branch versioned, the AGSServiceGeodatabase will fail to load.

Parameters
portalItemA feature service AGSPortalItem.
versionNameThe existing version to connect to when the AGSServiceGeodatabase loads.
See also
AGSServiceGeodatabase::portalItem
Since
100.12

◆ initWithPortalItem:versionName:sessionType:

- (instancetype) initWithPortalItem: (AGSPortalItem *)  portalItem
versionName: (NSString *)  versionName
sessionType: (AGSFeatureServiceSessionType sessionType 

Creates a new AGSServiceGeodatabase object from a feature service portal item, and connects to a specific version in the feature service.

If a version with the name does not exist, or the service is not branch versioned, the AGSServiceGeodatabase will fail to load. If using AGSFeatureServiceSessionTypePersistent, it is important to call closeWithCompletion: before destruction.

Parameters
portalItemA feature service AGSPortalItem.
versionNameThe existing version to connect to when the AGSServiceGeodatabase loads.
sessionTypeThe type of read and edit sessions to use when working with the service.
See also
AGSServiceGeodatabase::portalItem
Since
100.12

◆ initWithURL:

- (instancetype) initWithURL: (NSURL *)  URL

Creates an AGSServiceGeodatabase object connected to the default version in a feature service

If the service is branch versioned, the AGSServiceGeodatabase will connect to the default version.

Parameters
URLThe URL of the feature service or the portal item to connect to.
Since
100.9

◆ initWithURL:sessionType:

- (instancetype) initWithURL: (NSURL *)  URL
sessionType: (AGSFeatureServiceSessionType sessionType 

Creates an AGSServiceGeodatabase object connected to the default version in a feature service.

If the service is branch versioned, the AGSServiceGeodatabase will connect to the default version.

If using AGSFeatureServiceSessionTypePersistent, it is important to call closeWithCompletion: before destruction.

Parameters
URLThe URL of the feature service or the portal item to connect to.
sessionTypeThe type of read and edit sessions to use when working with the service.
Since
100.10

◆ initWithURL:versionName:

- (instancetype) initWithURL: (NSURL *)  URL
versionName: (NSString *)  versionName 

Creates an AGSServiceGeodatabase object connected to a specific version in a feature service.

If a version with the name does not exist, or the service is not branch versioned, the AGSServiceGeodatabase will fail to load.

Parameters
URLThe URL of the feature service or the portal item to connect to.
versionNameThe existing version to connect to when the AGSServiceGeodatabase loads.
Since
100.9

◆ initWithURL:versionName:sessionType:

- (instancetype) initWithURL: (NSURL *)  URL
versionName: (NSString *)  versionName
sessionType: (AGSFeatureServiceSessionType sessionType 

Creates an AGSServiceGeodatabase object connected to a specific version in a feature service.

If a version with the name does not exist, or the service is not branch versioned, the AGSServiceGeodatabase will fail to load.

If using AGSFeatureServiceSessionTypePersistent, it is important to call closeWithCompletion: before destruction.

Parameters
URLThe URL of the feature service or the portal item to connect to.
versionNameThe existing version to connect to when the AGSServiceGeodatabase loads.
sessionTypeThe type of read and edit sessions to use when working with the service.
Since
100.10

◆ loadDidFinishWithError:

- (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.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ 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

◆ onLoadStatusChanged

- (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.

Since
100

Provided by category AGSLoadableBase(ForSubclassEyesOnly).

◆ 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

◆ serviceGeodatabaseWithPortalItem:

+ (instancetype) serviceGeodatabaseWithPortalItem: (AGSPortalItem *)  portalItem

Creates a new AGSServiceGeodatabase object from a feature service portal item, and connects to the default version in the feature service.

If the service is branch versioned, the AGSServiceGeodatabase will connect to the default version.

Parameters
portalItemA feature service AGSPortalItem.
See also
AGSServiceGeodatabase::portalItem
Since
100.12

◆ serviceGeodatabaseWithPortalItem:sessionType:

+ (instancetype) serviceGeodatabaseWithPortalItem: (AGSPortalItem *)  portalItem
sessionType: (AGSFeatureServiceSessionType sessionType 

Creates a new AGSServiceGeodatabase object from a feature service portal item, and connects to the default version in the feature service.

If the service is branch versioned, the AGSServiceGeodatabase will connect to the default version.

If using AGSFeatureServiceSessionTypePersistent, it is important to call closeWithCompletion: before destruction.

Parameters
portalItemA feature service AGSPortalItem.
sessionTypeThe type of read and edit sessions to use when working with the service.
See also
AGSServiceGeodatabase::portalItem
Since
100.12

◆ serviceGeodatabaseWithPortalItem:versionName:

+ (instancetype) serviceGeodatabaseWithPortalItem: (AGSPortalItem *)  portalItem
versionName: (NSString *)  versionName 

Creates a new AGSServiceGeodatabase object from a feature service portal item, and connects to a specific version in the feature service.

If a version with the name does not exist, or the service is not branch versioned, the AGSServiceGeodatabase will fail to load.

Parameters
portalItemA feature service AGSPortalItem.
versionNameThe existing version to connect to when the AGSServiceGeodatabase loads.
See also
AGSServiceGeodatabase::portalItem
Since
100.12

◆ serviceGeodatabaseWithPortalItem:versionName:sessionType:

+ (instancetype) serviceGeodatabaseWithPortalItem: (AGSPortalItem *)  portalItem
versionName: (NSString *)  versionName
sessionType: (AGSFeatureServiceSessionType sessionType 

Creates a new AGSServiceGeodatabase object from a feature service portal item, and connects to a specific version in the feature service.

If a version with the name does not exist, or the service is not branch versioned, the AGSServiceGeodatabase will fail to load. If using AGSFeatureServiceSessionTypePersistent, it is important to call closeWithCompletion: before destruction.

Parameters
portalItemA feature service AGSPortalItem.
versionNameThe existing version to connect to when the AGSServiceGeodatabase loads.
sessionTypeThe type of read and edit sessions to use when working with the service.
See also
AGSServiceGeodatabase::portalItem
Since
100.12

◆ serviceGeodatabaseWithURL:

+ (instancetype) serviceGeodatabaseWithURL: (NSURL *)  URL

Creates an AGSServiceGeodatabase connected to the default version in a feature service.

If the service is branch versioned, the AGSServiceGeodatabase will connect to the default version.

Parameters
URLThe URL of the feature service or the portal item to connect to.
Returns
A new service geodatabase from the URL.
Since
100.9

◆ serviceGeodatabaseWithURL:sessionType:

+ (instancetype) serviceGeodatabaseWithURL: (NSURL *)  URL
sessionType: (AGSFeatureServiceSessionType sessionType 

Creates a new AGSServiceGeodatabase connected to the default version in a feature service.

If the service is branch versioned, the AGSServiceGeodatabase will connect to the default version.

If using AGSFeatureServiceSessionTypePersistent, it is important to call closeWithCompletion: before destruction.

Parameters
URLThe URL of the feature service or the portal item to connect to.
sessionTypeThe type of read and edit sessions to use when working with the service.
Returns
A new service geodatabase from the URL.
Since
100.10

◆ serviceGeodatabaseWithURL:versionName:

+ (instancetype) serviceGeodatabaseWithURL: (NSURL *)  URL
versionName: (NSString *)  versionName 

Creates an AGSServiceGeodatabase connected to a specific version in a feature service.

If a version with the name does not exist, or the service is not branch versioned, the AGSServiceGeodatabase will fail to load.

Parameters
URLThe URL of the feature service or the portal item to connect to.
versionNameThe existing version to connect to when the AGSServiceGeodatabase loads.
Returns
A new service geodatabase from the URL.
Since
100.9

◆ serviceGeodatabaseWithURL:versionName:sessionType:

+ (instancetype) serviceGeodatabaseWithURL: (NSURL *)  URL
versionName: (NSString *)  versionName
sessionType: (AGSFeatureServiceSessionType sessionType 

Creates an AGSServiceGeodatabase connected to a specific version in a feature service.

If a version with the name does not exist, or the service is not branch versioned, the AGSServiceGeodatabase will fail to load.

If using AGSFeatureServiceSessionTypePersistent, it is important to call closeWithCompletion: before destruction.

Parameters
URLThe URL of the feature service or the portal item to connect to.
versionNameThe existing version to connect to when the AGSServiceGeodatabase loads.
sessionTypeThe type of read and edit sessions to use when working with the service.
Returns
A new service geodatabase from the URL.
Since
100.10

◆ switchVersionWithName:completion:

- (id<AGSCancelable>) switchVersionWithName: (NSString *)  versionName
completion: (void(^)(NSError *__nullable error))  completion 

Switches all connected feature tables to the new version.

An error is returned if:

Check the result of hasLocalEdits: before attempting to switch versions, to make sure all changes are saved to the service or discarded from the local cache. Use the applyEditsWithCompletion: or undoLocalEditsWithCompletion: methods as appropriate to save or discard changes before switching versions.

Parameters
versionNameThe name of the version to connect to.
completionThe error parameter is populated on failure.
Returns
An operation which can be canceled.
Since
100.9

◆ tableWithLayerID:

- (nullable AGSServiceFeatureTable *) tableWithLayerID: (NSInteger)  layerID

Creates a service feature table object from the ID of a layer or table in the service.

If a table instance for the layer already exists in AGSServiceGeodatabase::connectedTables, the existing object will be returned. Otherwise, a new AGSServiceFeatureTable will be created.

Parameters
layerIDThe layer id for which to create the table.
Returns
A table instance for working with the table or layer in the feature service. If no table or layer exists in the service with the given ID, nil is returned.
Since
100.9

◆ undoLocalEditsWithCompletion:

- (id<AGSCancelable>) undoLocalEditsWithCompletion: (void(^)(NSError *__nullable error))  completion

Undoes all of the local edits in all the tables.

Parameters
completionThe error parameter is populated on failure.
Returns
An operation which can be canceled.
See also
AGSFeatureServiceSessionType
Since
100.9

Property Documentation

◆ connectedTables

- (NSArray<AGSServiceFeatureTable *>*) connectedTables
readnonatomiccopy

An array of feature tables managed by the AGSServiceGeodatabase.

Since
100.9

◆ credential

- (AGSCredential*) credential
readwritenonatomicstronginherited

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

Since
100

◆ defaultVersionName

- (NSString*) defaultVersionName
readnonatomiccopy

The name of the default version.

Since
100.9

◆ 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

◆ portalItem

- (AGSPortalItem*) portalItem
readnonatomicstrong

The AGSPortalItem which the AGSServiceGeodatabase was created from.

See also
- initWithPortalItem:
Since
100.12

◆ 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

◆ serviceInfo

- (AGSArcGISFeatureServiceInfo*) serviceInfo
readnonatomicstrong

The metadata of the service this object is connected to.

Since
100.9

◆ sessionType

- (AGSFeatureServiceSessionType) sessionType
readwritenonatomicassign

The type of read and edit sessions to use when working with the service.

The default value is AGSFeatureServiceSessionTypeTransient.

If the feature service this AGSServiceGeodatabase references is not branch-versioned, only AGSFeatureServiceSessionTypeTransient is supported.

If using AGSFeatureServiceSessionTypePersistent, it is important to call closeWithCompletion: before destruction.

Cannot be set after the AGSServiceGeodatabase is loaded. When the AGSServiceGeodatabase is created by loading an AGSMap, use AGSLoadSettings to control the session type.

See also
AGSLoadSettings::featureServiceSessionType
Since
100.10

◆ supportsBranchVersioning

- (BOOL) supportsBranchVersioning
readnonatomicassign

Whether the service supports branch versioning.

Since
100.9

◆ URL

- (NSURL*) URL
readrequirednonatomicstronginherited

The URL of the remote resource.

Since
100

◆ versionName

- (NSString*) versionName
readnonatomiccopy

The name of the version the AGSServiceGeodatabase is currently connected to.

To change the version this AGSServiceGeodatabase is connected to, use the switchVersionWithName:completion: method.

Since
100.9