How to upload an audio file to MMessage ios 10?

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) } } } 
+6
source share
1 answer

According to the bug reporter, I have to use the insertAttachment API to insert MP3, WAV and M4a.

 conversation.insertAttachment(fileUrl, withAlternateFilename: "fileAudio") { error in if let error = error { print(error) } 
+1
source

All Articles