How can I get the path of each item in an array of ALAssets?
I would like to get the images so that I can add them to an email
e.g.
NSString
If you have an array of ALAssets then you can load the asset data.
for (ALAsset *asset in assetsArray)
{
// You cannot use ALAsset URL for file access in NSFileManager or NSData.
// Get asset data. But be careful with very large data:
ALAssetRepresentation *rep = [asset defaultRepresentation];
unsigned long repSize = (unsigned long)rep.size;
Byte *buffer = (Byte *)malloc(repSize);
NSUInteger length = [rep getBytes:buffer fromOffset:0 length:repSize error:nil];
NSData *myData = [NSData dataWithBytesNoCopy:buffer length:length freeWhenDone:YES];
// fileName parameter in addAttachmentData:mimeType:fileName: can be any string.
// You can take asset file name:
NSString *fileName = [rep filename];
// Then use in call:
[mailViewController addAttachmentData:myData mimeType:@"image/png" fileName:fileName];
}