简体   繁体   English

MFMessageComposeViewController不显示消息正文

[英]MFMessageComposeViewController does not show message body

I have implemented the send message from my app using MFMessageComposeViewController. 我已经使用MFMessageComposeViewController从我的应用程序实现了发送消息。

When the app loads the message view controller I get only the message recipient and a cancel button and no message body or Send button. 当应用程序加载消息视图控制器时,我仅收到消息收件人和取消按钮,而没有消息正文或“发送”按钮。

I do add the message recipient and message body before initializing the MFMessageComposeViewController. 在初始化MFMessageComposeViewController之前,我确实添加了邮件收件人和邮件正文。

Now when I touch on the recipient list, then Message body and Send button pops up. 现在,当我触摸收件人列表时,将弹出“邮件正文”和“发送”按钮。

Can I ensure that the message body and Send button shows up at the same time as Message recipients and the cancel button. 我可以确保邮件正文和“发送”按钮与“邮件收件人”和“取消”按钮同时显示。

The code is as follows: 代码如下:

Button on click of which action is triggered. 单击触发操作的按钮。

@IBAction func sendMessage(sender: AnyObject) {
    if (self.canSendText()) {
        let messageComposeVC = self.configuredMessageComposeViewController()
        presentViewController(messageComposeVC, animated: true, completion: nil)
    } else {
        // Code to send error message
    }
}

Code to verify if message can be sent 验证消息是否可以发送的代码

func canSendText() -> Bool {
    return MFMessageComposeViewController.canSendText()
}

Code to compose the View Controller 编写视图控制器的代码

func configuredMessageComposeViewController() -> MFMessageComposeViewController {
    let messageComposeVC = MFMessageComposeViewController()
    messageComposeVC.messageComposeDelegate = self  
    messageComposeVC.recipients = [SomeVariable]
    messageComposeVC.body = SomeText.text!
    return messageComposeVC
}

Here is how it looks like when the MFMessageComposeViewcontroller looks like for the first time. 这是MFMessageComposeViewcontroller第一次的外观。

So, I just deleted the whole thing and tried to create a new Scene and a new View controller from scratch. 因此,我只是删除了整个内容,并尝试从头开始创建一个新的Scene和一个新的View控制器。 And it solved the problem. 它解决了问题。 I ultimately used the same steps and same code as mentioned below in official Apple page. 我最终使用了与下面Apple官方页面所述相同的步骤和相同的代码。

https://developer.apple.com/library/ios/documentation/MessageUI/Reference/MFMessageComposeViewController_class/ https://developer.apple.com/library/ios/documentation/MessageUI/Reference/MFMessageComposeViewController_class/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MFMessageComposeViewController显示带有突出显示的消息正文以进行编辑 - MFMessageComposeViewController show with message body highlighted for editing MFMessageComposeViewController使消息主体重复两次 - MFMessageComposeViewController having the message body repeated twice iOS 6 MFMessageComposeViewController缺少消息正文文本字段 - iOS 6 MFMessageComposeViewController missing message body text field 在MFMailComposeViewController和MFMessageComposeViewController中使用'&'字符时截断正文消息 - Truncation of body message when using '&' character with MFMailComposeViewController and MFMessageComposeViewController 用隐藏的键盘显示MFMessageComposeViewController - Show MFMessageComposeViewController with hidden keyboard 知道最终的收件人和“ MFMessageComposeViewController”消息吗? - Knowing the final recipients & message with 'MFMessageComposeViewController'? 使用MFMessageComposeViewController发送消息失败 - sending message using MFMessageComposeViewController failed MFMessageComposeViewController不发送消息 - MFMessageComposeViewController doesn't send out the message 直接发送消息而不显示MFMessageComposeViewController - Send message directly without presenting MFMessageComposeViewController Urban Airship iOS在UIWebView上显示消息体 - Urban Airship iOS show message body on UIWebView
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM