Joe*_*101 1 iphone attachment uiimage mfmailcomposeviewcontroller
我想使用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 .....//
Run Code Online (Sandbox Code Playgroud)
image是我的UIImage截图的名称.我不知道该替换它.
在此先感谢您的帮助/协助.
小智 14
addAttachmentData的第一个参数是附件的NSData.如果你image
是UIImage,那试试这个:
NSData *data = UIImagePNGRepresentation(image);
[composer addAttachmentData:data
mimeType:@"image/png"
fileName:@"GameOver Screenshot.png"];
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3905 次 |
最近记录: |