Value of type 'MFMessageComposeViewController' has no member 'setUPIVerificationCodeSendCompletion'

262 Views Asked by At

I am trying to use setUPIVerificationCodeSendCompletion, a new instance method of MFMessageComposeViewController.

While trying to use it I am getting this error:
Value of type 'MFMessageComposeViewController' has no member 'setUPIVerificationCodeSendCompletion'.

The required entitlement(com.apple.developer.upi-device-validation) is also added to the app.

import MessageUI

class SendSms {
    
    func createMessageController() -> UIViewController {
        let vc = MFMessageComposeViewController()
        vc.setUPIVerificationCodeSendCompletion { result in
            print("\(result)")
        }
        return vc
    }
}
1

There are 1 best solutions below

0
Sommm On BEST ANSWER

As we observe the function setUPIVerificationCodeSendCompletion: written in Objective C language in MFMessageComposeViewController(UPI) category class and your code is written in swift language.

So access these method in swift class, you have to import #import <MessageUI/MFMessageComposeViewController+UPI.h> in your project bridge header.