Edit feature attachments


The sample demonstrates how you can add, delete and fetch attachments for a specific feature in a feature layer. Tap on a feature to show a callout. The callout specifies the number of attachments for that particular feature. Tap on the info button inside the callout to show a list of the feature's attachments. To add a new attachment tap on the + button. Delete an attachment by sliding a cell to left and tapping Delete. If the thumbnail is not already visible, select a row to display the thumbnail for that attachment.

How it works

The app uses the fetchAttachmentInfosWithCompletion method on AGSArcGISFeature to fetch information about attachments that belong to the feature. In its completion block, it returns an array of AGSAttachmentInfo objects. The number of these objects is used to specify the count, in the callout. The table view controller for attachments uses the fetchDataWithCompletion: on AGSAttachmentInfo to get the raw data for the attachment and generate a thumbnail. When you tap on the `+` button, a hard coded image is added as a new attachment using addAttachmentWithName:contentType:data:completion: method on the feature. Similarly, deleteAttachment:completion: method is used to delete an attachment. All these changes are still on the local feature table and in order to apply the edits to the service, the applyEditsWithCompletion: method is used on AGSServiceFeatureTable.

In this topic
  1. Description