swift - iMessage 应用 Xcode

标签 swift xcode ios10 imessage

大家好,我尝试构建一个 iMessage 应用程序。我想发送视频。此视频来自 Http 服务器....

import UIKit
import Messages

class MessagesViewController: MSMessagesAppViewController {

 @IBAction func bt3(_ sender: UIButton) {
        //VIDEO URL
        let videoUrl = URL(string: "https://---/app/test/test.m4v")

        let message = MSMessage()
        message.shouldExpire = false

        let layout = MSMessageTemplateLayout()
        layout.mediaFileURL = videoUrl

        message.layout = layout

        let conversation = activeConversation
        conversation?.insert(message, completionHandler: nil)
  }
}

你有什么建议?

最佳答案

mediaFileURL Documentation:

The media file URL must be a file URL. For video files, the system crops the left and right edges of the media file by 6 points, and rounds its corners. For audio files, it shows a graphical representation of the audio’s waveform.

您只能使用 mediaFileURL 发送本地视频文件。我会尝试在事件 MSConversation 中使用 insertText(_:completionHandler:) 方法发送 View 的内联预览。

关于swift - iMessage 应用 Xcode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41142447/

相关文章:

ios - 无法启动/private/var/containers/Bundle/Application/

ios - 自定义快速相机圈触摸响应

ios - 尝试针对游戏的特定部分拆分 iPhone 和 iPad 尺寸

ios - swift 3 : Hide UITableView if Empty

ios - 为什么我不能在自定义单元格中使用标签

ios - 使用场景套件和 swift IOS 调用 func 时出现 fatal error

ios - PkPaymentAuthorizationViewController didAuthorizePayment 不返回 token 值

ios - 转到特定的标签栏 View

ios - 使用 Sirikit xcode 8 的 RideBooking 概念

iOS10 - 圆角半径不适用于边框