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

Description

An attachment belonging to a popup.

Instances of this class represent an attachment belonging to a popup (AGSPopup).

This class provides a wrapper around the underlying AGSAttachment from AGSArcGISFeature, which makes it easier to deal with than dealing with AGSAttachments directly.

This object is considered "Loaded" when it has a #filepath. The name, contentType are always available. The #actualSize property is available before the attachment is loaded except for in the case when the attachment is created with a URL, in which the #actualSize will return -1 until it's loaded.

The #filepath is the main aspect of this object that is "Loadable".

Because "Loaded" means that we have the attachment data saved to a temporary location on disk, attachments can be "Local" but not yet loaded. However if it is Loaded, then it is always "Local".

Since
100
See also
AGSPopupAttachmentManager for creating, editing, and managing attachments
Inheritance diagram for AGSPopupAttachment:
AGSLoadableBase AGSObject <AGSLoadable>

Instance Methods

(void) - cancelLoad
 
(void) - doCancelLoading
 
(void) - doStartLoading:
 
(void) - fullDisplayImageWithCompletion:
 
(void) - generateThumbnailWithSize:completion:
 
(void) - generateThumbnailWithSize:scaleMode:completion:
 
(void) - loadDidFinishWithError:
 
(void) - loadWithCompletion:
 
(void) - onLoadStatusChanged
 
(void) - retryLoadWithCompletion:
 
(void) - sizeInBytesForPreferredSizeWithCompletion:
 

Properties

NSInteger actualSizeInBytes
 
NSString * contentType
 
AGSPopupAttachmentEditState editState
 
AGSAttachmentfeatureAttachment
 
NSURL * fileURL
 
BOOL isLocal
 
NSError * loadError
 
AGSLoadStatus loadStatus
 
NSString * name
 
AGSPopupAttachmentSize preferredSize
 
BOOL supportsPreferredSize
 
AGSPopupAttachmentType type
 

Method Documentation

◆ 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

◆ 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).

◆ fullDisplayImageWithCompletion:

- (void) fullDisplayImageWithCompletion: (void(^)(AGSImage *_Nullable image))  completion

Gets the full image for displaying the attachment in a full screen or some UI larger than a thumbnail.

Parameters
completionblock that is invoked when the operation completes.
Since
100

◆ generateThumbnailWithSize:completion:

- (void) generateThumbnailWithSize: (float)  size
completion: (void(^)(AGSImage *_Nullable image))  completion 

Generates a thumbnail for the attachment. Causes the attachment to load if necessary. The image will be scaled with aspect fill.

Parameters
sizeof the desired thumbnail image (in points)
completionblock that is invoked when the operation completes.
Since
100

◆ generateThumbnailWithSize:scaleMode:completion:

- (void) generateThumbnailWithSize: (float)  size
scaleMode: (AGSImageScaleMode scaleMode
completion: (void(^)(AGSImage *_Nullable image))  completion 

Generates a thumbnail for the attachment. Causes the attachment to load if necessary.

Parameters
sizeof the desired thumbnail image (in points)
scaleModeof the desired thumbnail image
completionblock that is invoked when the operation completes.
Since
100.3

◆ 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

◆ sizeInBytesForPreferredSizeWithCompletion:

- (void) sizeInBytesForPreferredSizeWithCompletion: (void(^)(NSInteger sizeInBytes))  completion

Gets the size of the attachment in bytes, taking into account the preferred size. If preferred size is not supported then returns the actual size.

Since
100

Property Documentation

◆ actualSizeInBytes

- (NSInteger) actualSizeInBytes
readnonatomicassign

The size in bytes of the original attachment. Not taking into account the preferred size.

Since
100

◆ contentType

- (NSString*) contentType
readnonatomiccopy

The MIME content type of the attachment.

Since
100

◆ editState

- (AGSPopupAttachmentEditState) editState
readnonatomicassign

The current edit state of the attachment. When adding or removing attachments the edit state of each attachment will be set accordingly. Once you apply the changes through the AGSPopupAttachmentManager then the edit state will be set to AGSPopupAttachmentEditStateOriginal

Since
100

◆ featureAttachment

- (AGSAttachment*) featureAttachment
readnonatomicstrong

The underlying attachment that this object wraps and helps with.

Since
100

◆ fileURL

- (NSURL*) fileURL
readnonatomicstrong

The local temporary filepath where we store the attachment once it's loaded. Returns nil if the attachment is not loaded.

Since
100

◆ isLocal

- (BOOL) isLocal
readnonatomicassign

Indicates whether or not "loading" (fetching the data) will cause it to go over the network. False if the loading will cause a network request. True if it just needs to pull the data from a database.

Since
100

◆ 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

◆ name

- (NSString*) name
readnonatomiccopy

The name of the attachments

Since
100

◆ preferredSize

- (AGSPopupAttachmentSize) preferredSize
readwritenonatomicassign

The size the attachment should be saved as. This property is only has an affect on attachments that have not been added to the table yet. Only applies to images, not videos.

Since
100

◆ supportsPreferredSize

- (BOOL) supportsPreferredSize
readnonatomicassign

If the attachment is an image, and it has an edit state of added then preferredSize can be set.

Since
100

◆ type

- (AGSPopupAttachmentType) type
readnonatomicassign

Returns the type of the attachment.

Since
100