So, I messed around with the iMessagesFramework, and to send data to another user, the data must be sent as URLComponents URL. However, I cannot figure out how to send a dictionary to use as a value messages.url.
func createMessage(data: dictionary) {
/*
The Dictionary has 3 values, 1 string and two arrays.
let dictionary = ["title" : "Title Of Dictionary", "Array1" : [String](), "Array2" : [String]() ] as [String : Any]
*/
let components = URLComponents()
let layout = MSMessageTemplateLayout()
layout.image = UIImage(named: "messages-layout.png")!
layout.imageTitle = "\(dictionary["title"])"
let message = MSMessage()
message.url = components.url!
message.layout = layout
self.activeConversation?.insert(message, completionHandler: { (error: Error?) in
print("Insert Message")
})
}
Does anyone know how I can send dictionary values as URLQueryItemsin URLComponentsto save as message.url?
PS: I was wondering if it is possible to create an extension for the dictionary storage URL, this is what I am trying to attack unsuccessfully.
source
share