Attach a photo to an email from my iPhone application

后端 未结 3 986
星月不相逢
星月不相逢 2021-01-07 10:22

I have an iPhone application that picks a photos from the photo album built in App. Now I want to add a sharing button with an option of sharing this photo by email , I can

3条回答
  •  生来不讨喜
    2021-01-07 11:02

    Assuming you have a UIImage from the image picker (or any other source), you first need to create an NSData object from the image. Use either the UIImageJPEGRepresentation or the UIImageJPEGRepresentation functions. Once you have the NSData object, add it as an attachment like you did in the code you posted.

    In most cases, the image will appear in the email after the main message body.

提交回复
热议问题