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

Description

Instances of this class represent an attachment in a local geodatabase.

Defined in:
AGSGDBAttachment.h ( ArcGIS library)

Since
10.2
Inheritance diagram for AGSGDBAttachment:

Instance Methods

(void) - fetchDataWithCompletion:
 
(NSString *) - filepath
 
(instancetype) - initAsJpgWithImage:name:
 
(instancetype) - initWithData:name:contentType:
 
(AGSImage *) - thumbnail
 

Class Methods

(instancetype) + attachmentAsJpgWithImage:name:
 
(instancetype) + attachmentWithData:name:contentType:
 
(instancetype) + attachmentWithUIImagePickerControllerInfoDictionary:
 
(void) + attachmentWithUIImagePickerControllerInfoDictionary:completion:
 

Properties

long long attachmentID
 
NSString * contentType
 
NSData * data
 
BOOL isLocal
 
NSString * name
 
NSInteger size
 

Method Documentation

+ (instancetype) attachmentAsJpgWithImage: (AGSImage *)  image
name: (NSString *)  name 

Returns a geodatabase attachment created with image and named name. The image will be converted to jpg. If you want to preserve your image type then use attachmentWithData:name:contentType:

Parameters
imageused to create the attachment
nameto be given to the attachment, including file extension
Since
10.2.2
+ (instancetype) attachmentWithData: (NSData *)  data
name: (NSString *)  name
contentType: (NSString *)  contentType 

Returns a geodatabase attachment created with data of type contentType and named name.

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
10.2.2
+ (instancetype) attachmentWithUIImagePickerControllerInfoDictionary: (NSDictionary *)  info

Returns a geodatabase attachment for the item chosen in a UIImagePickerController

Parameters
infoThe dictionary provided by UIImagePickerController
Since
10.2
Deprecated:
Deprecated at 10.2.2 due to memory issues with large files. Use attachmentWithUIImagePickerControllerInfoDictionary:completion instead.
+ (void) attachmentWithUIImagePickerControllerInfoDictionary: (NSDictionary *)  info
completion: (void(^)(AGSGDBAttachment *attachment))  completion 

Creates a geodatabase attachment for the item chosen in a UIImagePickerController

Parameters
infoThe dictionary provided by UIImagePickerController
completionThe completion block called when the operation completes
Since
10.2
- (void) fetchDataWithCompletion: (void(^)(NSData *attachmentData, NSError *error))  completionBlock

Fetches the data for the attachment if the attachment is remote. If isLocal is NO you must call fetchDataWithCompletion: before accessing the attachment data, filename or thumbnail.

Since
10.2.2
- (NSString*) filepath

Location on disk where the attachment data is available. The data will be saved to this location if it hasn't been already. Creates a temporary file if one doesn't exist for this attachment. Only works when isLocal is YES.

Since
10.2
- (instancetype) initAsJpgWithImage: (AGSImage *)  image
name: (NSString *)  name 

Initialize a geodatabase attachment with image and named name. The image will be converted to jpg. If you want to preserve your image type then use initWithData:name:contentType:

Parameters
imageused to create the attachment
nameto be given to the attachment, including file extension
Since
10.2.2
- (instancetype) initWithData: (NSData *)  data
name: (NSString *)  name
contentType: (NSString *)  contentType 

Initialize a geodatabase attachment with data of type contentType and named name.

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
10.2.2
- (AGSImage*) thumbnail

Returns a thumbnail image the attachment. Only works with some types of attachments - mainly images and videos. Only works when isLocal is YES.

Since
10.2

Property Documentation

- (long long) attachmentID
readnonatomicassign

The unique ID of the attachment.

- (NSString*) contentType
readwritenonatomiccopy

The MIME type of the attachment

Since
10.2
- (NSData*) data
readwritenonatomiccopy

The attachment data in binary format. If the attachment is not local, you must call fetchDataWithCompletion: before calling the data getter. Only works when isLocal is YES.

Since
10.2
- (BOOL) isLocal
readwritenonatomicassign

Whether the attachment data is local or it needs to be fetched. If this is NO then you must call fetchDataWithCompletion: before accessing the data, filename or thumbnail.

Since
10.2.2
- (NSString*) name
readwritenonatomiccopy

The name of the attachment

Since
10.2
- (NSInteger) size
readnonatomicassign

The size of the attachment in bytes

Since
10.2