根据文件:

@method     insertAttachment:withAlternateFilename:completionHandler:
@abstract   The NSURL instance provided in the URL parameter is inserted into the Messages.app
input field. This must be a file URL.
@param      URL                The URL to the media file to be inserted.
@param      filename           If you supply a string here, the message UI uses it for the attachment. Use an alternate filename to better describe the attachment or to make the name more readable.
@param      completionHandler  A completion handler called when the insert is complete.
 */
open func insertAttachment(_ URL: URL, withAlternateFilename filename: String?, completionHandler: (@escaping (Error?) -> Swift.Void)? = nil)

上面写着
文件名--->如果在此处提供字符串,则消息UI将使用它
附件。使用备用文件名更好地描述
附件或使名称更可读。
我的代码是:
if let conversation = activeConversation {
    conversation.insertAttachment(fileURL, withAlternateFilename: "This is file Description.", completionHandler: nil)
}

但它在消息应用程序中没有任何显示。
我在这里发送视频文件。
如果可能的话,我想在用户单击消息或MSMessage下方的导航栏标题上显示该说明。

最佳答案

根据最新的文件,尝试
func addAttachmentURL(_ attachmentURL: NSURL,withAlternateFilename alternateFilename: String?) -> Bool
https://developer.apple.com/library/ios/documentation/MessageUI/Reference/MFMessageComposeViewController_class/index.html#//apple_ref/occ/instm/MFMessageComposeViewController/addAttachmentURL:withAlternateFilename

10-08 14:14