我尝试使用setUPIVerificationCodeSendCompletion,MFMessageComposeViewController的一个新示例方法。
当我尝试使用它时,我得到了这个错误:
类型“MFMessageComposeViewController”的值没有成员“setUPIVerificationCodeSendCompletion”。
所需的授权(com.apple.developer.upi-device-validation)也会添加到应用程序中。
import MessageUI
class SendSms {
func createMessageController() -> UIViewController {
let vc = MFMessageComposeViewController()
vc.setUPIVerificationCodeSendCompletion { result in
print("\(result)")
}
return vc
}
}
1条答案
按热度按时间falq053o1#
正如我们在
MFMessageComposeViewController(UPI)
类别类中观察到用Objective C语言编写的函数setUPIVerificationCodeSendCompletion:
,而您的代码是用swift语言编写的。所以在swift类中访问这些方法,你必须在你的项目桥头中导入
#import <MessageUI/MFMessageComposeViewController+UPI.h>
。