ArcGIS Runtime SDK for iOS: AGSServiceGeodatabase Class Reference
ArcGIS Runtime SDK for iOS  100.9
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 >) - createVersionWithParameters:completion:
 
(id< AGSCancelable >) - fetchVersionsWithCompletion:
 
(BOOL) - hasLocalEdits
 
(instancetype) - initWithURL:
 
(instancetype) - initWithURL:versionName:
 
(void) - loadWithCompletion:
 
(void) - retryLoadWithCompletion:
 
(id< AGSCancelable >) - switchVersionWithName:completion:
 
(nullable AGSServiceFeatureTable *) - tableWithLayerID:
 
(id< AGSCancelable >) - undoLocalEditsWithCompletion:
 

Class Methods

(instancetype) + serviceGeodatabaseWithURL:
 
(instancetype) + serviceGeodatabaseWithURL:versionName:
 

Properties

NSArray< AGSServiceFeatureTable * > * connectedTables
 
AGSCredentialcredential
 
NSString * defaultVersionName
 
NSError * loadError
 
AGSLoadStatus loadStatus
 
AGSRequestConfigurationrequestConfiguration
 
AGSArcGISFeatureServiceInfoserviceInfo
 
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
completionBlock 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

§ 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

§ 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
completionBlock 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

§ 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
completionBlock 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

§ initWithURL:()

- (instancetype) initWithURL: (NSURL *)  URL

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

Parameters
URLThe URL of the service to connect to
Since
100.9

§ initWithURL:versionName:()

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

Creates a new 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 service to connect to.
versionNameThe existing version to connect to when the AGSServiceGeodatabase loads.
Since
100.9

§ 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

§ 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

§ serviceGeodatabaseWithURL:()

+ (instancetype) serviceGeodatabaseWithURL: (NSURL *)  URL

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

Parameters
URLThe URL of the service to connect to
Since
100.9

§ serviceGeodatabaseWithURL:versionName:()

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

Creates a new 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 service to connect to.
versionNameThe existing version to connect to when the AGSServiceGeodatabase loads.
Since
100.9

§ 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

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

§ 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

§ 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