I successfully save the image in my application after the user takes the picture. What I want to do later is when the user returns to the application, I want them to be able to send photos via email as an attachment. I will not be able to get data from the application converted to an image, so I can add it as an attachment. Can someone point me in the right direction, please. Here I save the image after they took the picture.
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
app.aImage2 = [info objectForKey:UIImagePickerControllerOriginalImage];
NSData *imageData = UIImagePNGRepresentation( app.aImage2 );
NSString * savedImageName = [NSString stringWithFormat:@"r%@aImage2.png",app.reportNumber];
NSArray * paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString * documentsDirectory = [paths objectAtIndex:0];
NSString * dataFilePath;
dataFilePath = [documentsDirectory stringByAppendingPathComponent:savedImageName];
[imageData writeToFile:dataFilePath atomically:YES];
[self dismissModalViewControllerAnimated:YES];
}
And here I have to attach it.
MFMailComposeViewController *picker = [[MFMailComposeViewController alloc] init];
picker.mailComposeDelegate = self;
source
share