so I played around the new beta version of xcode 8, and I can upload the image to the .image property, but I was not able to load the audio file with the .mediaFileURL property. here is mine
var message = MSMessage() var template = MSMessageTemplateLayout() viewDidLoad() { if let filePath2 = Bundle.main().pathForResource("synth", ofType: "wav") { let fileUrl = NSURL(string: filePath2) let URL2 = fileUrl as! URL template.mediaFileURL = URL2 } message.layout = template guard let conversation = activeConversation else { fatalError("Expected a conversation") } conversation.insert(message, localizedChangeDescription: nil) { error in if let error = error { print(error) } } }
source share