I am developing a chat app message sending is fine but unable to send the images in xmpp framework and i am using somessaging class for chat screen so ca any body tell me how to send the images in xmpp
0
votes
Possible duplicate of How to send image in chat usig xmpp framework
– Badal Shah
There are lots of question related to this please search it on Google. google.co.in/… . and to impliment image sending in somessaging you have to develop your own logic . First, understand somessaging how works. then send and receive photo using it else use your own custom collectionview or tableview with custom cell.
– Badal Shah
Thanks for replay i tried my own logic but not working well when i send image then all cell items are hidden i don't know how to implement do you have any sample code for this please i am struck here
– Bittoo
1 Answers
-1
votes
For sending image in Xmpp first you need to convert image to string format and while receiving image you need to convert string format to image format.
Sending Image
NSData *imageObj = UIImagePNGRepresentation(YourImage);
NSString *imageString = [imageObj base64EncodedString];
imageString = [imageString stringByReplacingOccurrencesOfString:@"+" withString:@"%2B"];
Receiving Image
NSString* _imageData =[SentImageString stringByReplacingOccurrencesOfString:@"%2B" withString:@"+"];
NSData *dataObj = [NSData dataFromBase64String:_imageData];
UIImage *image = [UIImage imageWithData:dataObj];