I use the follow code to send a JSQMessage with location, I dont have any error but the message doesnt show in view.
func locationManager(manager: CLLocationManager, didUpdateLocations locations: [CLLocation]) {
var latestLocation: CLLocation = locations[locations.count-1]
let loc: JSQLocationMediaItem = JSQLocationMediaItem(location: latestLocation)
loc.appliesMediaViewMaskAsOutgoing = true
let locmessage: JSQMessage = JSQMessage(senderId: self.senderId, senderDisplayName: self.senderDisplayName, date: NSDate(), media: loc)
messages.append(locmessage)
self.finishSendingMessageAnimated(true)
}
And
override func collectionView(collectionView: JSQMessagesCollectionView!, messageBubbleImageDataForItemAtIndexPath indexPath: NSIndexPath!) -> JSQMessageBubbleImageDataSource! {
let factory = JSQMessagesBubbleImageFactory()
if messages[indexPath.row].senderId == senderId {
return factory.outgoingMessagesBubbleImageWithColor(UIColor.lightGrayColor())
} else {
return factory.incomingMessagesBubbleImageWithColor(UIColor.greenColor())
}
}
No problem for other type of messages (photo and video).
Who can help me.
Thank you.