JSQMessages How to send a location message

I am using the following code to send JSQMessage with a location, I don't have any error, but the message does not appear in sight.

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 messages of a different type (photo and video).

Who can help me.

Thanks.

+5
source share

Source: https://habr.com/ru/post/1244502/


All Articles