如何通过 iPhone 应用程序在消息中附加图像?
我想发送带有图像数据的消息。所以我使用了 MFMessageComposeViewController 。 但该控制器仅提供短信服务。所以我使用 UIPasteBoard
附加了图像数据。 但它也不起作用。键入消息时不会创建“粘贴”按钮。在 UIPasteBoard
上附加图像显然是成功的。 我认为使用 MFMessageComposeViewController 并不能解决我的问题。 我怎样才能实现我的目标?
I want to send message with image data. So I used MFMessageComposeViewController
.
But that controller provide only SMS service. So I used UIPasteBoard
attached an image data.
But It doesn't work, either. There are no "Paste" button created when typing messages. Attaching image at UIPasteBoard
was clearly success.
I think using MFMessageComposeViewController
doesn't solve my problem.
How can I accomplish my goal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
这在当前的 MessageUI API 中是不可能的:MSMessageComposeViewController 不像 MFMailComposeViewController 那样接受附件。
当前执行此操作的唯一方法是使用外部服务,该服务允许您通过 REST 调用发送彩信。
GSMA 正是为此目的定义了 REST 规范:
http://www.gsmworld.com/oneapi/reference_documentation-version_1.html(此内容有多个 pdf 文件)页)
尝试找到实现此规范的本地服务提供商,然后就可以了。
只需将直接 wiki 链接添加到 OneAPI MMS 规范: http://gsma .securespsite.com/access/Access%20API%20Wiki/MMS%20RESTful%20API.aspx 以及 PHP/Java 沙箱的链接 https://github.com/OneAPI/GSMA-OneAPI 可以在本地测试彩信。干杯。
This is not possible with the current MessageUI API: the MSMessageComposeViewController doesn't accept attachments like the MFMailComposeViewController does.
The only way to do this currently is to use an external service that allows you to send mms via a REST call for example.
GSMA defines a REST specification for exactly this purpose:
http://www.gsmworld.com/oneapi/reference_documentation-version_1.html (multiple pdf's on this page)
Try to find a local service provider that implements this specification and you're good to go.
Just to add the direct wiki link to the OneAPI MMS spec: http://gsma.securespsite.com/access/Access%20API%20Wiki/MMS%20RESTful%20API.aspx and a link to the PHP/Java sandbox https://github.com/OneAPI/GSMA-OneAPI where MMS can be tested locally . Cheers.
这是正确的工作代码,它在我的设备上完美运行。
Here is the correct working code and it is working perfectly on my device.
我有同样的问题,我在此处发布。
中有一个错误MFMessageComposeViewController
如果您只使用下面的代码,它将启动一条消息,您可以将图像插入其中I had the same question that I posted here. There is a bug in
MFMessageComposeViewController
and if you just use the code below it will launch a message that you can insert images into本方法经过测试和验证。我在我的代码中使用了它。
您可以使用任何 jpeg、jpg 和 png 格式。
This Method is tested and verified. I Used it in my code.
You can use any jpeg jpg and png formats.
快捷的方式。适用于 iOS11
Swift way. Works in iOS11
为什么不通过 Share API 共享图像和文本(选择“消息”,如果您想排除 Facebook、Twitter 等......)
Why don't you share the Image and Text via the Share API (selecting Message, and if you want exluding Facebook, twitter etc..)