It is possible to set a unique id
and or tag
for a MSMessage
instance? My current app is based on data fetched from a server using an integer id as an identifier. When a previous message is selected I want to modify the view accordingly by fetching the id
or tag
(if possible) of the current message and using that in a query to my server.
override func willBecomeActive(with conversation: MSConversation) {
//Retrive id from selected message
if conversation.selectedMessage != nil{
//Do things
}
}
You can use the the URL of the message to add in it an "id" key:
guard let components = NSURLComponents(string: myBaseURL) else {
fatalError("Invalid base url")
}
let id = NSURLQueryItem(name: "id", value: yourIdHere)
components.queryItems = [id]
guard let url = components.url else {
fatalError("Invalid URL components.")
}
message.url = url
Use an hash of the date for your id or whatever you want