gpt4 book ai didi

ios - 使用未声明的类型 'MFMessageComposeViewControllerDelegate swift'

转载 作者:行者123 更新时间:2023-11-28 09:55:30 26 4
gpt4 key购买 nike

我正在尝试使用 MFMessageComposeViewController 对象实现发送文本消息。但是当我试图声明 MFMessageComposeViewControllerDelegate 协议(protocol)时。在 ViewController.swift 中,我收到以下错误:use of undeclared type 'MFMessageComposeViewControllerDelegate swift'

ViewController.swift:

class ViewController: UIViewController, MFMessageComposeViewControllerDelegate {

@IBAction func sendMessage(sender: AnyObject) {
var messageVC = MFMessageComposeViewController()

messageVC.body = "Enter a message";
messageVC.recipients = ["Enter tel-nr"]
messageVC.messageComposeDelegate = self;

self.presentViewController(messageVC, animated: false, completion: nil)
}


override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
}

有人可以帮帮我吗?

最佳答案

添加MessageUI框架,

import UIKit
import MessageUI

class ViewController: UIViewController, MFMessageComposeViewControllerDelegate {

}

希望对你有帮助

关于ios - 使用未声明的类型 'MFMessageComposeViewControllerDelegate swift',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38048956/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com