I would like to provide my users the ability to send an image/picture (displayed through a UIImageView in the app) to their friends via email using the built-in Mail app.
我想让我的用户能够使用内置的Mail应用程序通过电子邮件将图像/图片(通过应用程序中的UIImageView显示)发送给他们的朋友。
In a way, I want a very similar user experience to the way the Photos app does this. User clicks on a button, the image/picture is copied onto a new "compose" mail window on Mail app, and then they can finish sending the message over to whoever they want.
在某种程度上,我希望与照片应用程序执行此操作的方式具有非常相似的用户体验。用户点击按钮,图像/图片被复制到Mail应用程序上的新“撰写”邮件窗口,然后他们可以完成将邮件发送给他们想要的任何人。
I searched quite a bit for tips on how to do this, and found nothing. A few people actually posted before on different message boards that this is not possible at all in SDK-land.
我搜索了很多关于如何做到这一点的提示,但一无所获。实际上,有些人在不同的留言板上发布过,这在SDK-land中完全不可能。
Anyone with more information on this?
有更多相关信息的人?
2 个解决方案
#1
3
If you plan on putting the app in the App Store, you're limited to the standard mailto links as specified in the iPhone URL Scheme Reference:
如果您打算将应用程序放入App Store,则仅限于iPhone URL Scheme Reference中指定的标准mailto链接:
The options you have within the mailto link are spelled out in RFC 2368:
您在mailto链接中拥有的选项在RFC 2368中详细说明:
http://www.ietf.org/rfc/rfc2368.txt
The only thing that seemed remotely possible was using the mailto link to set the headers to describe the message as having an attachment and then adding in the MIME/base64 encoded data within the body of the message. I highly doubt that such an approach would work since the mailto link was not intended to be used this way - the RFC states:
唯一可能的远程可能是使用mailto链接设置标题以将消息描述为具有附件,然后在消息正文中添加MIME / base64编码数据。我非常怀疑这种方法是否有效,因为mailto链接不打算以这种方式使用 - RFC规定:
"The mailto URL is primarily intended for generation of short text messages that are actually the content of automatic processing (such as "subscribe" messages for mailing lists), not general MIME bodies."
“mailto URL主要用于生成实际上是自动处理内容的短文本消息(例如邮件列表的”订阅“消息),而不是一般的MIME主体。”
However, even if the above method did work, the RFC still leaves it open to the email client to choose to ignore or otherwise modify "dangerous" headers within the link - so even if you were able to construct a valid mailto URL with a MIME body and the proper headers, Mail.app may still choose to ignore the attachment related parts of your message.
但是,即使上述方法确实有效,RFC仍然允许电子邮件客户端选择忽略或以其他方式修改链接中的“危险”标题 - 因此,即使您能够使用MIME构建有效的mailto URL正文和正确的标题,Mail.app仍然可以选择忽略您的邮件的附件相关部分。
If you try to communicate with Mail.app in any other way, you have a very high likelihood of being rejected by Apple.
如果您尝试以任何其他方式与Mail.app通信,您很有可能被Apple拒绝。
#2
0
send the image to a web application that will inturn do the sending. using the mailto scheme will launch iphone's email application but your application will quit meaning the user will have to relaunch it later..
将图像发送到将执行发送的Web应用程序。使用mailto方案将启动iphone的电子邮件应用程序,但您的应用程序将退出意味着用户将不得不重新启动它。
#1
3
If you plan on putting the app in the App Store, you're limited to the standard mailto links as specified in the iPhone URL Scheme Reference:
如果您打算将应用程序放入App Store,则仅限于iPhone URL Scheme Reference中指定的标准mailto链接:
The options you have within the mailto link are spelled out in RFC 2368:
您在mailto链接中拥有的选项在RFC 2368中详细说明:
http://www.ietf.org/rfc/rfc2368.txt
The only thing that seemed remotely possible was using the mailto link to set the headers to describe the message as having an attachment and then adding in the MIME/base64 encoded data within the body of the message. I highly doubt that such an approach would work since the mailto link was not intended to be used this way - the RFC states:
唯一可能的远程可能是使用mailto链接设置标题以将消息描述为具有附件,然后在消息正文中添加MIME / base64编码数据。我非常怀疑这种方法是否有效,因为mailto链接不打算以这种方式使用 - RFC规定:
"The mailto URL is primarily intended for generation of short text messages that are actually the content of automatic processing (such as "subscribe" messages for mailing lists), not general MIME bodies."
“mailto URL主要用于生成实际上是自动处理内容的短文本消息(例如邮件列表的”订阅“消息),而不是一般的MIME主体。”
However, even if the above method did work, the RFC still leaves it open to the email client to choose to ignore or otherwise modify "dangerous" headers within the link - so even if you were able to construct a valid mailto URL with a MIME body and the proper headers, Mail.app may still choose to ignore the attachment related parts of your message.
但是,即使上述方法确实有效,RFC仍然允许电子邮件客户端选择忽略或以其他方式修改链接中的“危险”标题 - 因此,即使您能够使用MIME构建有效的mailto URL正文和正确的标题,Mail.app仍然可以选择忽略您的邮件的附件相关部分。
If you try to communicate with Mail.app in any other way, you have a very high likelihood of being rejected by Apple.
如果您尝试以任何其他方式与Mail.app通信,您很有可能被Apple拒绝。
#2
0
send the image to a web application that will inturn do the sending. using the mailto scheme will launch iphone's email application but your application will quit meaning the user will have to relaunch it later..
将图像发送到将执行发送的Web应用程序。使用mailto方案将启动iphone的电子邮件应用程序,但您的应用程序将退出意味着用户将不得不重新启动它。