10.2.5: AGSAttachmentManager Class Reference
10.2.5
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Pages
AGSAttachmentManager Class Reference

Description

Instances of this class represent a light-weight and coarse-grained object for managing attachments of a particular feature in a feature layer. This object allows the user to make changes on the client regarding the attachments collection for a feature and then later on either cancel these edits or sync (post) the changes to the server. You can get a handle to an attachment manager for a feature using the attachmentManagerForFeature: (AGSFeatureLayer) method.

See also
Conceptual Doc: Working with the Attachment Manager
Sample: Feature Layer Editing
Since
2.0
Inheritance diagram for AGSAttachmentManager:
<AGSFeatureLayerEditingDelegate>

Instance Methods

(AGSAttachment *) - addAttachmentAsJpgWithImage:name:
 
(AGSAttachment *) - addAttachmentWithData:name:contentType:
 
(AGSAttachment *) - addAttachmentWithUIImagePickerControllerInfoDictionary:
 
(void) - addAttachmentWithUIImagePickerControllerInfoDictionary:completion:
 
(AGSAttachment *) - attachmentForId:
 
(void) - cancelAllDownloadDataOperations
 
(void) - cancelDownloadAttachmentInfos
 
(void) - cancelDownloadDataForId:
 
(void) - cancelLocalEdits
 
(void) - cancelPostLocalEditsToServer
 
(void) - downloadAttachmentDataForId:
 
(void) - downloadAttachmentInfos
 
(void) - featureLayer:operation:didAttachmentEditsWithResults:
 
(void) - featureLayer:operation:didFailAttachmentEditsWithError:
 
(void) - featureLayer:operation:didFailFeatureEditsWithError:
 
(void) - featureLayer:operation:didFailQueryAttachmentInfosWithError:
 
(void) - featureLayer:operation:didFailRetrieveAttachmentWithError:
 
(void) - featureLayer:operation:didFeatureEditsWithResults:
 
(void) - featureLayer:operation:didQueryAttachmentInfosWithResults:
 
(void) - featureLayer:operation:didRetrieveAttachmentWithData:
 
(BOOL) - hasLocalEdits
 
(void) - markAttachment:forDeletion:
 
(void) - postLocalEditsToServer
 

Properties

NSArray * attachments
 
id< AGSAttachmentManagerDelegatedelegate
 
NSError * downloadAttachmentInfosError
 
AGSFeatureLayerfeatureLayer
 
NSInteger featureObjectId
 
BOOL postingLocalEdits
 

Method Documentation

- (AGSAttachment*) addAttachmentAsJpgWithImage: (AGSImage *)  image
name: (NSString *)  name 

Adds an attachment. Does not upload it to the server until postLocalEditsToServer is called. The image will be converted to jpg. If you want to preserve your image type then use addAttachmentWithData:name:contentType:

Parameters
imageto add as an attachment
nameto be given to the attachment, including file extension
Since
2.0
- (AGSAttachment*) addAttachmentWithData: (NSData *)  data
name: (NSString *)  name
contentType: (NSString *)  contentType 

Adds an attachment. Does not upload it to the server until postLocalEditsToServer is called.

Parameters
dataThe raw binary data of the attachment
nameto be given to the attachment, including file extension
contentTypeThe MIME type of the data. For eg image/png
Since
2.0
- (AGSAttachment*) addAttachmentWithUIImagePickerControllerInfoDictionary: (NSDictionary *)  info

Adds an attachment. Does not upload it to the server until postLocalEditsToServer is called.

Parameters
infoThe dictionary provided by UIImagePickerController
Since
2.0
Deprecated:
Deprecated at 10.2.2 due to memory issues with large files. Use addAttachmentWithUIImagePickerControllerInfoDictionary:completion instead.
- (void) addAttachmentWithUIImagePickerControllerInfoDictionary: (NSDictionary *)  info
completion: (void(^)(AGSAttachment *attachment))  completion 

Adds an attachment. Does not upload it to the server until postLocalEditsToServer is called.

Parameters
infoThe dictionary provided by UIImagePickerController
completionThe completion block called when the operation completes
Since
10.2.2
- (AGSAttachment*) attachmentForId: (NSInteger)  attachmentId

Finds the attachment for a particular attachment id.

Since
2.0
- (void) cancelAllDownloadDataOperations

Cancels all download data operations that may be in progress or outstanding.

Since
2.0
- (void) cancelDownloadAttachmentInfos

Cancels the operation that is downloading the attachment metadata.

Since
2.0
- (void) cancelDownloadDataForId: (NSInteger)  attachmentId

Cancels downloading data for a particular attachment.

Since
2.0
- (void) cancelLocalEdits

Cancels all local edits.

Since
2.0
- (void) cancelPostLocalEditsToServer

Cancels the operations that are posting local edits to the server. It is possible that some operations may already be done, only the outstanding ones will be cancelled.

Since
2.0
- (void) downloadAttachmentDataForId: (NSInteger)  attachmentId

Kicks off an asynchronous operation to download the attachment data for an attachment with a particular id. This operation can be cancelled with the cancelDownloadDataForId: method. The delegate will be informed when this operation is completed.

Parameters
attachmentIdID of the attachment for which to download the data
Since
2.0
See also
- attachmentManager:didDownloadDataForAttachment: (AGSAttachmentManagerDelegate-p) , method on delegate for success or failure
- (void) downloadAttachmentInfos

Kicks off an asynchronous operation to download the attachment metadata for the feature that this attachment manager is associated with. This operation can be cancelled with the cancelDownloadAttachmentInfos method. The delegate will be informed when this operation is completed.

Since
2.0
See also
- attachmentManager:didDownloadAttachmentInfos: (AGSAttachmentManagerDelegate-p) , method on delegate for success
downloadAttachmentInfosError for error
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didAttachmentEditsWithResults: (AGSFeatureLayerAttachmentResults *)  attachmentResults 
optionalinherited

Tells the delegate that AGSFeatureLayer successfully completed making the attachment edits (adds, updates, or deletes). It is possible that a subset of the edits failed. You should inspect the provided AGSFeatureLayerAttachmentResults object to find out which edits (if any) failed.

Parameters
featureLayerFeature Layer on which the attachment edit operation was executed.
opThe operation that is performing the server request.
attachmentResultsResults returned by the attachment edit operation.
Since
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didFailAttachmentEditsWithError: (NSError *)  error 
optionalinherited

Tells the delegate that AGSFeatureLayer encountered an error while making the attachment edits (adds, updates, or deletes).

Parameters
featureLayerFeature Layer on which the attachment edit operation was executed.
opThe operation that is performing the server request.
errorInformation returned by the attachment edit operation.
Since
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didFailFeatureEditsWithError: (NSError *)  error 
optionalinherited

Tells the delegate that AGSFeatureLayer encountered an error while making the feature edits (adds, updates, or deletes).

Parameters
featureLayerFeature Layer on which the feature edit operation was executed.
opThe operation that is performing the server request.
errorInformation returned by the feature edit operation.
Since
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didFailQueryAttachmentInfosWithError: (NSError *)  error 
optionalinherited

Tells the delegate that AGSFeatureLayer encountered an error while querying attachment metadata.

Parameters
featureLayerFeature Layer on which the query attachment infos operation was executed.
opThe operation that is performing the server request.
errorInformation returned by the query attachment infos operation.
Since
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didFailRetrieveAttachmentWithError: (NSError *)  error 
optionalinherited

Tells the delegate that AGSFeatureLayer encountered an error while querying the actual attachment data.

Parameters
featureLayerFeature Layer on which the retrieve attachment operation was executed.
opThe operation that is performing the server request.
errorInformation returned by the retrieve attachment operation.
Since
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didFeatureEditsWithResults: (AGSFeatureLayerEditResults *)  editResults 
optionalinherited

Tells the delegate that AGSFeatureLayer successfully completed making the feature edits (adds, updates, or deletes). It is possible that a subset of the edits failed. You should inspect the provided AGSFeatureLayerEditResults object to find out which edits (if any) failed.

Parameters
featureLayerFeature Layer on which the feature edit operation was executed.
opThe operation that is performing the server request.
editResultsResults returned by the feature edit operation.
Since
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didQueryAttachmentInfosWithResults: (NSArray *)  attachmentInfos 
optionalinherited

Tells the delegate that AGSFeatureLayer successfully completed querying attachment metadata.

Parameters
featureLayerFeature Layer on which the query attachment infos operation was executed.
opThe operation that is performing the server request.
attachmentInfosArray of AGSAttachmentInfo objects returned by the query.
Since
1.0
- (void) featureLayer: (AGSFeatureLayer *)  featureLayer
operation: (NSOperation *)  op
didRetrieveAttachmentWithData: (NSData *)  attachmentData 
optionalinherited

Tells the delegate that AGSFeatureLayer successfully completed querying the actual attachment data.

Parameters
featureLayerFeature Layer on which the retrieve attachment operation was executed.
opThe operation that is performing the server request.
attachmentDataThe raw NSData object associated with the attachment.
Since
1.0
- (BOOL) hasLocalEdits

Indidcates whether the attachment manager contain any local edits on the client (i.e if any attachments have been added, or deleted).

Since
2.0
- (void) markAttachment: (AGSAttachment *)  attachment
forDeletion: (BOOL)  del 

Marks an attachment for deletion. Does not actually delete it from the server until postLocalEditsToServer is called.

Parameters
attachmentwhich must be marked for deletion
delwhether to mark or unmark the attachment for deletion
Since
2.0
- (void) postLocalEditsToServer

Kicks off the asynchronous operations required to sync local edits contained in this attachment manager with the server. This operation can be cancelled with the cancelPostLocalEditsToServer method. The delegate will be informed when this operation is completed.

Since
2.0
See also
- attachmentManager:didPostLocalEditsToServer: (AGSAttachmentManagerDelegate-p) , method on delegate for success or failure

Property Documentation

- (NSArray*) attachments
readnonatomiccopy

The attachments belonging to the feature that this attachment manager is associated with.

Since
2.0
- (id<AGSAttachmentManagerDelegate>) delegate
readwritenonatomicweak

The delegate that is notified when operations complete.

Since
2.0
- (NSError*) downloadAttachmentInfosError
readnonatomicstrong

The error, if any, that occurred when attempting to download attachment metadata.

Since
2.0
- (AGSFeatureLayer*) featureLayer
readnonatomicweak

The feature layer that this attachment manager is associated with.

Since
2.0
- (NSInteger) featureObjectId
readnonatomicassign

The object id of the feature that this attachment manager is associated with.

Since
2.0
- (BOOL) postingLocalEdits
readnonatomicassign

Indicates whether or not the attachment manager is currently posting local edits to the remote server.

Since
2.0