在iphone上使用xmpp框架发送图像 [英] Sending image using xmpp framework on iphone

查看:135
本文介绍了在iphone上使用xmpp框架发送图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在iPhone上使用XMPP框架作为聊天应用程序。我想使用XMPP框架从我的应用程序发送图像。任何人都可以建议我,怎么做?

I am using XMPP framework on iPhone for my chatting application. I want to send image from my app using the XMPP framework. Can anyone suggest me, how to do this?

任何帮助将不胜感激。

Any help would be appreciated.

推荐答案

添加额外的标签,例如

<attachment>base64 of your image </attachment>

因此通过将图像转换为base64字符串并将base64字符串转换回发送方来发送图像接收方的图像。

Thus sent your image in the sender side by converting it to base64 string and convert the base64 string back into image in the receiver side.

只需将Uiimage转换为base64encoded编码,然后通过xmpp发送它作为带有任何附加标签的消息,如attachement ..然后在接收器中side获取带有base64内容的消息并将base64encoded字符串转换回UIImage

编码和解码的代码在此链接中:

Just convert the Uiimage into a base64encoded coding and then sent it through xmpp as a message with any extra tag like attachement.. Then in the receiver side get the message with the base64 content and convert back the base64encoded string into UIImage
The code for encode and decode is in this link :

< a href =http://iphonesdksnippets.com/post/2010/03/14/Convert-image-tofrom-text-%28Base64%29.aspx\"rel =nofollow> http://iphonesdksnippets.com/post /2010/03/14/Convert-image-tofrom-text-%28Base64%29.aspx

...请参考..如果你有任何疑问或者您想要一个简短的解释,只需在这里发表评论我会回复它。

... Just refer it.. If you have any doubt or you want a brief explanation, just comment here i will respond to it..

这篇关于在iphone上使用xmpp框架发送图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆