Closed Koutenshidatshu closed 8 years ago
`
func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : AnyObject]) {
var image : UIImage
image = (info[UIImagePickerControllerOriginalImage] as? UIImage)!
var photoItem = JSQPhotoMediaItem()
photoItem.image = image
let fullMessage = JSQMessage(senderId: OneChat.sharedInstance.xmppStream?.myJID.bare(), senderDisplayName: OneChat.sharedInstance.xmppStream?.myJID.bare(), date: NSDate(), media: photoItem)
messages.addObject(fullMessage)
let mediaItem:JSQMessageMediaData = fullMessage!.media
photoItem = mediaItem as! JSQPhotoMediaItem
if (mediaItem.isKindOfClass(JSQPhotoMediaItem)) {
if let recipient = recipient {
OneMessage.sendMessage("image", to: recipient.jidStr, completionHandler: { (stream, image) -> Void in
JSQSystemSoundPlayer.jsq_playMessageSentSound()
self.finishSendingMessageAnimated(true)
})
}
}
self.dismissViewControllerAnimated(true, completion: nil)
} `
Hello @Koutenshidatshu I don't understand the problem here, this is not an issue at all, you should ask this kind of question on StackOverflow. Closing this now
Hi, i want to ask how to send message image from photo gallery in swift?
here is the function after select photo and then sending the image