I want to send a photo from the camera roll to a web services - including its exif data. Im using ASIFormDataRequest - so I do :
ASIFormDataRequest *request
ok - i think i figured it out. The trick is to go with the defaultRepresentaion's raw data:
ALAsset* selectedAsset = [assets objectAtIndex:index];
int byteArraySize = selectedAsset.defaultRepresentation.size;
NSMutableData* rawData = [[NSMutableData alloc]initWithCapacity:byteArraySize];
void* bufferPointer = [rawData mutableBytes];
NSError* error=nil;
[selectedAsset.defaultRepresentation getBytes:bufferPointer fromOffset:0 length:byteArraySize error:&error];
if (error) {
NSLog(@"%@",error);
}
rawData = [NSMutableData dataWithBytes:bufferPointer length:byteArraySize];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *cachesDirectory = [paths objectAtIndex:0];
NSString* filePath = [NSString stringWithFormat:@"%@/imageTemp.png",cachesDirectory];
[rawData writeToFile:filePath atomically:YES];
After using the path to send the image to the server the file on the server keeps all the exif data