将图像附加到电子邮件中?
我想使用 MFMailComposeViewController 发送电子邮件,并且我已经进行了设置,但我在实际将图像(屏幕截图)附加到电子邮件中时遇到了麻烦。
这是代码行。
[composer addAttachmentData:image mimeType:image/png //png undeclared//fileName:@"GameOver Screenshot.png"]; //Incompatible Obj-C types 'struct UIImage *' expected 'struct NSData *' when passing argument 1 of .....//
image 是我的 UIImage 屏幕截图的名称。我不知道用什么来代替它。
预先感谢您的帮助/帮助。
I want to to use MFMailComposeViewController to send an email, and I already have that set up, but I'm having trouble actually attaching an image, which is a screenshot, into the email.
Here's the line of code.
[composer addAttachmentData:image mimeType:image/png //png undeclared//fileName:@"GameOver Screenshot.png"]; //Incompatible Obj-C types 'struct UIImage *' expected 'struct NSData *' when passing argument 1 of .....//
image is the name of my UIImage screenshot. I'm not sure what to replace it with.
Thanks in advance for the help/assistance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
addAttachmentData 的第一个参数是附件的 NSData。如果您的
image
是 UIImage,请尝试以下操作:The first parameter to addAttachmentData is an NSData of the attachment. If your
image
is a UIImage, then try this: