当前位置: 动力学知识库 > 问答 > 编程问答 >

ios - Sending audio with custom keyboard imessage style

问题描述:

I'm having some issues sending .m4a-files with a custom keyboard, I've managed to send .wav-files without any issues, however these are not "playable" in the same way as an audio message. I read somewhere that you should rename the sent file to Audio Message.m4a in order for the user to be able to play it as they would with a real audio message.

While using "com.microsoft.waveform-audio" when sending .wav-files work fine, my keyboard simply does nothing when using "kUTTypeMPEG4Audio" while adding to the pasteboard.

let url: NSURL = Bundle.main.url(forResource: "\(self.soundArray[indexPath.row])", withExtension: ".m4a")! as NSURL

let data = NSData(contentsOf: url as URL)

pb.setData(data! as Data, forPasteboardType: kUTTypeMPEG4Audio as String)

Am I missing something, or is there any workaround for this?

分享给朋友:
您可能感兴趣的文章:
随机阅读: