ArcGIS Runtime SDK for iOS
100.15
|
Base class for operations that perform http requests.
The request will execute on a background thread. Once the response has been parsed the completion blocks will called.
Instance Methods | |
(void) | - cancel |
(void) | - cancel |
(void) | - didComplete: |
(void) | - doCancel |
(void) | - doExecute |
(void) | - doneExecuting |
(void) | - execute |
(instancetype) | - initWithRemoteResource:request: |
(instancetype) | - initWithRemoteResource:URL:queryParameters: |
(instancetype) | - initWithRemoteResource:URL:queryParameters:method: |
(instancetype) | - initWithURL: |
(BOOL) | - isCanceled |
(BOOL) | - isPaused |
(BOOL) | - isRegisteredListener: |
(BOOL) | - pause |
(void) | - registerListener:forCompletion: |
(void) | - resume |
(void) | - unregisterListener: |
Properties | |
BOOL | canceled |
BOOL | cancelSessionWhenOperationIsCanceled |
AGSCredential * | credential |
NSError * | error |
void(^ | internalCompletion )(void) |
id< AGSLoadable > | loadDependency |
AGSRequestHTTPMethod | method |
NSURL * | outputFileURL |
NSProgress * | progress |
void(^ | progressHandler )(long long totalBytesDownloaded, long long totalBytesExpected) |
NSDictionary< NSString *, id > * | queryParameters |
id< AGSRemoteResource > | remoteResource |
NSURLRequest * | request |
AGSRequestConfiguration * | requestConfiguration |
NSURLResponse * | response |
id | result |
NSString * | sessionID |
BOOL | startAsynchronously |
AGSOperationState | state |
long long | totalBytesDownloaded |
long long | totalBytesExpected |
NSURL * | URL |
|
requiredinherited |
Cancel the operation
- (void) cancel |
Cancels the operation.
- (void) didComplete: | (BOOL) | everStarted |
Subclasses should override if they want to run some code once the operation is completed. This function is guaranteed to only be called once. everStarted
will be NO if the operation was canceled before it could be started.
Provided by category AGSOperationBase(ForSubclassEyesOnly).
- (void) doCancel |
Subclasses can override to do the actual work to cancel the operation. Once cancel is complete, call doneExecuting. For operations that do not do all of their work in doExecute, it makes sense to override this and cancel any network connections, etc. Then when the cancel is complete, you call doneExecuting. For operations where the work is all done in doExecute they shouldn't need to override this, you should just check the isCanceled
property throughout the execution of the operation and if it is canceled then call doneExecuting
and return.
Provided by category AGSOperationBase(ForSubclassEyesOnly).
- (void) doExecute |
Subclasses should override to do the actual execution of the operation. Once done, call doneExecuting
.
Provided by category AGSOperationBase(ForSubclassEyesOnly).
- (void) doneExecuting |
Subclasses should call this when they are done executing or done cancelling.
Provided by category AGSOperationBase(ForSubclassEyesOnly).
- (void) execute |
Starts the operation
- (instancetype) initWithRemoteResource: | (nullable id< AGSRemoteResource >) | remoteResource | |
request: | (NSURLRequest *) | NS_DESIGNATED_INITIALIZER | |
Initialize an AGSRequestOperation
with the specified request.
remoteResource | The AGSRemoteResource which is responsible for making the request. When the remoteResource is set, properties will get pulled from that such as the credential, requestConfiguration, etc. |
request | Request to initialize the operation with. |
AGSRequestOperation
. - (instancetype) initWithRemoteResource: | (nullable id< AGSRemoteResource >) | remoteResource | |
URL: | (NSURL *) | URL | |
queryParameters: | (nullable NSDictionary< NSString *, id > *) | queryParameters | |
Initialize an AGSRequestOperation
with the specified remote resource, url and query parameters.
remoteResource | The AGSRemoteResource which is responsible for making the request. When the remoteResource is set, properties will get pulled from that such as the credential, requestConfiguration, etc. |
URL | URL to initialize the request operation. |
queryParameters | Query parameters to submit along with the request. |
AGSRequestOperation
. - (instancetype) initWithRemoteResource: | (nullable id< AGSRemoteResource >) | remoteResource | |
URL: | (NSURL *) | URL | |
queryParameters: | (nullable NSDictionary< NSString *, id > *) | queryParameters | |
method: | (AGSRequestHTTPMethod) | NS_DESIGNATED_INITIALIZER | |
Initialize an AGSRequestOperation
with the specified remote resource, url, query parameters and HTTP method.
remoteResource | The AGSRemoteResource which is responsible for making the request. When the remoteResource is set, properties will get pulled from that such as the credential, requestConfiguration, etc. |
URL | URL to initialize the request operation. |
queryParameters | Query parameters to submit along with the request. |
method | The AGSRequestHTTPMethod to be used with this request. |
AGSRequestOperation
. - (instancetype) initWithURL: | (NSURL *) | url |
Initialize an AGSRequestOperation
with the specified url.
url | URL to initialize the request operation. |
AGSRequestOperation
.
|
requiredinherited |
Indicates whether the operation has been canceled
- (BOOL) isPaused |
Indicates whether the operation is paused.
isPaused
property through the NSProgress API (exposed via NSProgressReporting
through the progress
property). - (BOOL) isRegisteredListener: | (id) | listener |
Returns whether or not the specified object is a registered as a listener to this operation.
- (BOOL) pause |
Pause the operation. Returns YES if it isPaused is YES after calling this. If the operation is in a state where it cannot be paused, it will return NO. For example if the operation is canceled or done.
pause
method through the NSProgress API (exposed via NSProgressReporting
through the progress
property). - (void) registerListener: | (id) | listener | |
forCompletion: | (void(^)(id __nullable result, NSError *__nullable error)) | completion | |
Adds a completion handler to the operation for the specified listener. If you are using this option, you can unregister a completionHandler for a listener if you need to. When there are no more listeners the operation will be canceled automatically.
listener | The listener to add the completion block for. |
completion | The completion handler to be called. |
- (void) resume |
Resumes an operation after it's been paused. Only valid to be called when isPaused is YES.
resume
method through the NSProgress API (exposed via NSProgressReporting
through the progress
property). - (void) unregisterListener: | (id) | listener |
Removes the registered completion handler to the operation for the specified listener. When there are no more listeners the operation will be canceled automatically. To avoid any potential retain cycles the listener is not retained by the operation. Unregistering is just the way to tell the operation that you no longer care about getting the completion event.
listener | The listener to unregister |
|
readnonatomicassigninherited |
Whether or not cancel has been called on the operation. "Canceled" is a modifier on the current state since:
|
readwritenonatomicassign |
Defaults to YES. Specifies whether or not the download session used to download the file is canceled when the operation is canceled. Otherwise the session stays in the state that it was in. The value of occasionally being able to set this to NO is that you can cancel the operation, which is taking the spot in the queue and have the download continue out of process, or remain paused, if you wish.
|
readwritenonatomicstrong |
Security credentials to access the remote resource. Only applicable if the resource is secured.
|
readnonatomicstronginherited |
The error, if any, that occurred.
|
readwritenonatomiccopyinherited |
The block the operation will call to signify to the operation queue that the operation is complete. This block is reserved for use by the AGSOperationQueue. Do not assign your own block to this.
|
readwritenonatomicweak |
The id<AGSLoadable> object that should be loaded before this request is kicked off.
|
readwritenonatomicassign |
Flag to determine whether or not the request is a GET or a POST and if it is a post how it's parameters are encoded.
|
readwritenonatomicstrong |
If this is set then the data is saved to this file as it is retrieved. Must be set to a local file URL.
|
readnonatomicstrong |
The progress for this operation. As a consumer of this progress property, you can observe it's property changes and pause, cancel, resume. Do not, however, set the readwrite properties of this progress object. Those are reserved for internal use. Setting them externally will corrupt the state and lead to undefined behavior.
|
readwritenonatomiccopy |
If provided, the operation will call this block with the progress of the request. If the content length is unknown or not specified in the request, totalBytesExpected
will return -1.
|
readatomiccopy |
Query parameters to be used in the request to URL.
|
readnonatomicweak |
The remote resource, if applicable, that is making the web request.
|
readnonatomicstrong |
Request object to be used instead of generating one on the fly.
|
readwritenonatomicstrong |
The AGSRequestConfiguration object which defines the behavior and policies to use when accessing the remote resource. Defaults to the [AGSRequestConfiguration globalConfiguration]
|
readnonatomicstrong |
The response of the request.
|
readnonatomicstronginherited |
The results of an operation. It will be of type NSDictionary
when the result is json, AGSImage
when the result is an image, and NSData
when anything else.
|
readwritenonatomiccopy |
If provided, the operation will use NSURLSession to allow for downloading in the background. This requires that outputFileURL
is also specified.
|
readwritenonatomicassigninherited |
Subclasses can set this if they want to be started asynchronously or not. If an operation does most or all of it's work in doExecute
it should set this to YES. If an operation returns quickly from doExecute
and does all of it's work on a different queue then this value should be NO. The default value is YES.
Provided by category AGSOperationBase(ForSubclassEyesOnly).
|
readnonatomicassigninherited |
The current state of the operation.
|
readnonatomicassign |
The number of bytes currently downloaded for this request.
|
readnonatomicassign |
The total number of bytes expected to be downloaded. Will be -1 if unknown.
|
readnonatomicstrong |
URL of the resource to make a request from.