Reputation: 71
I am doing a greeting card app.I do all sorts of stuff on my view like adding cliparts, messages etc on my view.I have saved the images thus created to my photo album using UIImageWriteToSavedPhotosAlbum() function.
Now i want to enable the users to send the card via email.I am not getting any method to access the image file.This is my call to add attachments.
[mailViewController addAttachmentData:myData mimeType:@"image/png" fileName:@""];
Is there any other method to add attachment or can anyone tell me a way to get the filename. Please help.
Upvotes: 0
Views: 449
Reputation: 4732
UIImageWriteToSavedPhotosAlbum adds images to camera roll album. all pictures stored there have special code insteed of name you gave them, when saved to your app's local storage place. You cant get images fron camera roll by name. You may ask user to choose pictures from camera roll album via UIImagePicerController, or store all your cards in app's local storage.
Upvotes: 0
Reputation: 3927
The filename here for this function is the display name in the email attachment.
If you need to attach the image data to the email, what you need is only to convert the UIImage to NSData by UIImagePNGRepresentation
or UIImageJPEGRepresentation
and set corresponding mimeType to this function.
NSData *imageData = UIImagePNGRepresentation(image);
[mailViewController addAttachmentData:imageData mimeType:@"image/png" fileName:@"attachmentNameDisplayInEmail"];
Upvotes: 1